@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | $_GET['page'] = 'formidable'; |
| 20 | 20 | |
| 21 | - $values = array( |
|
| 21 | + $values = array( |
|
| 22 | 22 | 'id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), |
| 23 | 23 | 'doing_ajax' => true, |
| 24 | 24 | ); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | ob_start(); |
| 43 | 43 | self::load_single_field( $field, $values ); |
| 44 | - $field_html[ absint( $field->id ) ] = ob_get_contents(); |
|
| 44 | + $field_html[absint( $field->id )] = ob_get_contents(); |
|
| 45 | 45 | ob_end_clean(); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | foreach ( $opts as $opt_key => $opt ) { |
| 257 | 257 | if ( strpos( $opt, '|' ) !== false ) { |
| 258 | 258 | $vals = explode( '|', $opt ); |
| 259 | - $opts[ $opt_key ] = array( |
|
| 259 | + $opts[$opt_key] = array( |
|
| 260 | 260 | 'label' => trim( $vals[0] ), |
| 261 | 261 | 'value' => trim( $vals[1] ), |
| 262 | 262 | ); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $other_array = array(); |
| 272 | 272 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 273 | 273 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
| 274 | - $other_array[ $opt_key ] = $opt; |
|
| 274 | + $other_array[$opt_key] = $opt; |
|
| 275 | 275 | } |
| 276 | 276 | unset( $opt_key, $opt ); |
| 277 | 277 | } |
@@ -313,18 +313,18 @@ discard block |
||
| 313 | 313 | $disabled_fields = FrmAppHelper::pro_is_installed() ? array() : $pro_field_selection; |
| 314 | 314 | $frm_settings = FrmAppHelper::get_settings(); |
| 315 | 315 | |
| 316 | - if ( ! isset( $all_field_types[ $field['type'] ] ) ) { |
|
| 316 | + if ( ! isset( $all_field_types[$field['type']] ) ) { |
|
| 317 | 317 | // Add fallback for an add-on field type that has been deactivated. |
| 318 | - $all_field_types[ $field['type'] ] = array( |
|
| 318 | + $all_field_types[$field['type']] = array( |
|
| 319 | 319 | 'name' => ucfirst( $field['type'] ), |
| 320 | 320 | 'icon' => 'frm_icon_font frm_pencil_icon', |
| 321 | 321 | ); |
| 322 | - } elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) { |
|
| 322 | + } elseif ( ! is_array( $all_field_types[$field['type']] ) ) { |
|
| 323 | 323 | // Fallback for fields added in a more basic way. |
| 324 | - FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] ); |
|
| 324 | + FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] ); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - $type_name = $all_field_types[ $field['type'] ]['name']; |
|
| 327 | + $type_name = $all_field_types[$field['type']]['name']; |
|
| 328 | 328 | if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) { |
| 329 | 329 | $type_name = $all_field_types['divider|repeat']['name']; |
| 330 | 330 | } |
@@ -387,13 +387,13 @@ discard block |
||
| 387 | 387 | $active = 'default_value'; |
| 388 | 388 | |
| 389 | 389 | foreach ( $settings as $type ) { |
| 390 | - if ( ! empty( $field[ $type ] ) ) { |
|
| 390 | + if ( ! empty( $field[$type] ) ) { |
|
| 391 | 391 | $active = $type; |
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - $types[ $active ]['class'] .= ' current'; |
|
| 396 | - $types[ $active ]['current'] = true; |
|
| 395 | + $types[$active]['class'] .= ' current'; |
|
| 396 | + $types[$active]['current'] = true; |
|
| 397 | 397 | |
| 398 | 398 | return $types; |
| 399 | 399 | } |
@@ -407,8 +407,8 @@ discard block |
||
| 407 | 407 | 'website' => 'url', |
| 408 | 408 | 'image' => 'url', |
| 409 | 409 | ); |
| 410 | - if ( isset( $type_switch[ $type ] ) ) { |
|
| 411 | - $type = $type_switch[ $type ]; |
|
| 410 | + if ( isset( $type_switch[$type] ) ) { |
|
| 411 | + $type = $type_switch[$type]; |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | $pro_fields = FrmField::pro_field_selection(); |
@@ -532,11 +532,11 @@ discard block |
||
| 532 | 532 | // include "col" for valid html |
| 533 | 533 | $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
| 534 | 534 | |
| 535 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
| 535 | + if ( ! isset( $calc[$unit] ) ) { |
|
| 536 | 536 | return; |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 539 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit]; |
|
| 540 | 540 | |
| 541 | 541 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
| 542 | 542 | } |
@@ -729,11 +729,11 @@ discard block |
||
| 729 | 729 | private static function get_form_for_js_validation( $field ) { |
| 730 | 730 | global $frm_vars; |
| 731 | 731 | if ( ! empty( $frm_vars['js_validate_forms'] ) ) { |
| 732 | - if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) { |
|
| 733 | - return $frm_vars['js_validate_forms'][ $field['form_id'] ]; |
|
| 732 | + if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) { |
|
| 733 | + return $frm_vars['js_validate_forms'][$field['form_id']]; |
|
| 734 | 734 | } |
| 735 | - if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) { |
|
| 736 | - return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ]; |
|
| 735 | + if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) { |
|
| 736 | + return $frm_vars['js_validate_forms'][$field['parent_form_id']]; |
|
| 737 | 737 | } |
| 738 | 738 | } |
| 739 | 739 | return false; |
@@ -804,10 +804,10 @@ discard block |
||
| 804 | 804 | |
| 805 | 805 | if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
| 806 | 806 | $add_html[] = $v; |
| 807 | - } elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 808 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
| 807 | + } elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
| 808 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
| 809 | 809 | } else { |
| 810 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 810 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | unset( $k, $v ); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $metas = FrmEntryMeta::get_entry_meta_info( $entry_exist ); |
| 78 | 78 | $field_metas = array(); |
| 79 | 79 | foreach ( $metas as $meta ) { |
| 80 | - $field_metas[ $meta->field_id ] = $meta->meta_value; |
|
| 80 | + $field_metas[$meta->field_id] = $meta->meta_value; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | $filtered_vals = array_filter( $values['item_meta'] ); |
@@ -131,10 +131,10 @@ discard block |
||
| 131 | 131 | $reduced = array(); |
| 132 | 132 | foreach ( $filter_vals as $field_id => $value ) { |
| 133 | 133 | $field = FrmFieldFactory::get_field_object( $field_id ); |
| 134 | - $reduced[ $field_id ] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
| 135 | - $reduced[ $field_id ] = $field->set_value_before_save( $reduced[ $field_id ] ); |
|
| 136 | - if ( '' === $reduced[ $field_id ] || ( is_array( $reduced[ $field_id ] ) && 0 === count( $reduced[ $field_id ] ) ) ) { |
|
| 137 | - unset( $reduced[ $field_id ] ); |
|
| 134 | + $reduced[$field_id] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
| 135 | + $reduced[$field_id] = $field->set_value_before_save( $reduced[$field_id] ); |
|
| 136 | + if ( '' === $reduced[$field_id] || ( is_array( $reduced[$field_id] ) && 0 === count( $reduced[$field_id] ) ) ) { |
|
| 137 | + unset( $reduced[$field_id] ); |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | return $reduced; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it |
| 328 | 328 | LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON it.form_id=fr.id WHERE "; |
| 329 | 329 | |
| 330 | - $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
| 330 | + $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
| 331 | 331 | $query_args = array( $id ); |
| 332 | 332 | $query = $wpdb->prepare( $query, $query_args ); // WPCS: unprepared SQL ok. |
| 333 | 333 | |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | private static function prepare_entries( &$entries ) { |
| 373 | 373 | foreach ( $entries as $k => $entry ) { |
| 374 | 374 | self::prepare_entry( $entry ); |
| 375 | - $entries[ $k ] = $entry; |
|
| 375 | + $entries[$k] = $entry; |
|
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | |
@@ -397,20 +397,20 @@ discard block |
||
| 397 | 397 | foreach ( $metas as $meta_val ) { |
| 398 | 398 | if ( $meta_val->item_id == $entry->id ) { |
| 399 | 399 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
| 400 | - $entry->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 400 | + $entry->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 401 | 401 | if ( $include_key ) { |
| 402 | - $entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ]; |
|
| 402 | + $entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id]; |
|
| 403 | 403 | } |
| 404 | 404 | continue; |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | // include sub entries in an array |
| 408 | - if ( ! isset( $entry->metas[ $meta_val->field_id ] ) ) { |
|
| 409 | - $entry->metas[ $meta_val->field_id ] = array(); |
|
| 408 | + if ( ! isset( $entry->metas[$meta_val->field_id] ) ) { |
|
| 409 | + $entry->metas[$meta_val->field_id] = array(); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
| 413 | - $entry->metas[ $meta_val->field_id ][] = $meta_val->meta_value; |
|
| 413 | + $entry->metas[$meta_val->field_id][] = $meta_val->meta_value; |
|
| 414 | 414 | |
| 415 | 415 | unset( $meta_val ); |
| 416 | 416 | } |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | if ( $inc_form ) { |
| 459 | 459 | $fields = 'it.*, fr.name as form_name,fr.form_key as form_key'; |
| 460 | - $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
| 460 | + $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) { |
@@ -501,16 +501,16 @@ discard block |
||
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | foreach ( $metas as $m_key => $meta_val ) { |
| 504 | - if ( ! isset( $entries[ $meta_val->item_id ] ) ) { |
|
| 504 | + if ( ! isset( $entries[$meta_val->item_id] ) ) { |
|
| 505 | 505 | continue; |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | - if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) { |
|
| 509 | - $entries[ $meta_val->item_id ]->metas = array(); |
|
| 508 | + if ( ! isset( $entries[$meta_val->item_id]->metas ) ) { |
|
| 509 | + $entries[$meta_val->item_id]->metas = array(); |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
| 513 | - $entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 513 | + $entries[$meta_val->item_id]->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 514 | 514 | unset( $m_key, $meta_val ); |
| 515 | 515 | } |
| 516 | 516 | |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | private static function get_entry_value( $values, $name, $default ) { |
| 691 | - return isset( $values[ $name ] ) ? $values[ $name ] : $default; |
|
| 691 | + return isset( $values[$name] ) ? $values[$name] : $default; |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | /** |
@@ -75,19 +75,19 @@ discard block |
||
| 75 | 75 | global $frm_vars; |
| 76 | 76 | $form_id = FrmForm::get_current_form_id(); |
| 77 | 77 | |
| 78 | - $columns[ $form_id . '_id' ] = 'ID'; |
|
| 79 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 78 | + $columns[$form_id . '_id'] = 'ID'; |
|
| 79 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 80 | 80 | |
| 81 | 81 | if ( $form_id ) { |
| 82 | 82 | self::get_columns_for_form( $form_id, $columns ); |
| 83 | 83 | } else { |
| 84 | - $columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' ); |
|
| 85 | - $columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' ); |
|
| 86 | - $columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' ); |
|
| 84 | + $columns[$form_id . '_form_id'] = __( 'Form', 'formidable' ); |
|
| 85 | + $columns[$form_id . '_name'] = __( 'Entry Name', 'formidable' ); |
|
| 86 | + $columns[$form_id . '_user_id'] = __( 'Created By', 'formidable' ); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
| 90 | - $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
| 89 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
| 90 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
| 91 | 91 | self::maybe_add_ip_col( $form_id, $columns ); |
| 92 | 92 | |
| 93 | 93 | $frm_vars['cols'] = $columns; |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
| 137 | 137 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
| 138 | - unset( $sub_form_cols[ $k ] ); |
|
| 138 | + unset( $sub_form_cols[$k] ); |
|
| 139 | 139 | continue; |
| 140 | 140 | } |
| 141 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 141 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 142 | 142 | unset( $sub_form_col ); |
| 143 | 143 | } |
| 144 | 144 | } |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | $has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' ); |
| 156 | 156 | $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] == 'post_status'; |
| 157 | 157 | if ( $has_separate_value && ! $is_post_status ) { |
| 158 | - $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); |
|
| 158 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 ); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); |
|
| 161 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 ); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | private static function maybe_add_ip_col( $form_id, &$columns ) { |
| 165 | 165 | if ( FrmAppHelper::ips_saved() ) { |
| 166 | - $columns[ $form_id . '_ip' ] = 'IP'; |
|
| 166 | + $columns[$form_id . '_ip'] = 'IP'; |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | foreach ( $meta_value as $mk => $mv ) { |
| 202 | 202 | // Remove blank values. |
| 203 | 203 | if ( empty( $mv ) ) { |
| 204 | - unset( $meta_value[ $mk ] ); |
|
| 204 | + unset( $meta_value[$mk] ); |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | foreach ( $fields as $field ) { |
| 279 | 279 | if ( self::field_supports_sorting( $field ) ) { |
| 280 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
| 280 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | $atts['form_id'] . '_item_key' => '', |
| 354 | 354 | $atts['form_id'] . '_id' => '', |
| 355 | 355 | ); |
| 356 | - $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
| 356 | + $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
| 357 | 357 | |
| 358 | 358 | $i = $atts['i']; |
| 359 | 359 | |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | |
| 365 | 365 | if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) { |
| 366 | 366 | $result[] = $col_key; |
| 367 | - $i--; |
|
| 367 | + $i --; |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | unset( $col_key, $col ); |
@@ -497,9 +497,9 @@ discard block |
||
| 497 | 497 | if ( ! isset( $frm_vars['form_params'] ) ) { |
| 498 | 498 | $frm_vars['form_params'] = array(); |
| 499 | 499 | } |
| 500 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
| 500 | + $frm_vars['form_params'][$form->id] = $params; |
|
| 501 | 501 | |
| 502 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
| 502 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
| 503 | 503 | return; |
| 504 | 504 | } |
| 505 | 505 | |
@@ -515,16 +515,16 @@ discard block |
||
| 515 | 515 | */ |
| 516 | 516 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
| 517 | 517 | |
| 518 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
| 518 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
| 519 | 519 | |
| 520 | 520 | if ( empty( $errors ) ) { |
| 521 | 521 | $_POST['frm_skip_cookie'] = 1; |
| 522 | 522 | $do_success = false; |
| 523 | 523 | if ( $params['action'] == 'create' ) { |
| 524 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
| 525 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
|
| 524 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
| 525 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); |
|
| 526 | 526 | |
| 527 | - $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id']; |
|
| 527 | + $params['id'] = $frm_vars['created_entries'][$form_id]['entry_id']; |
|
| 528 | 528 | $do_success = true; |
| 529 | 529 | } |
| 530 | 530 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
| 235 | 235 | |
| 236 | 236 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 237 | - $new_values[ $col ] = $values[ $col ]; |
|
| 237 | + $new_values[$col] = $values[$col]; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | $new_values['options'] = self::maybe_filter_options( $values['options'] ); |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 246 | 246 | |
| 247 | 247 | if ( isset( $values['id'] ) ) { |
| 248 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 248 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 249 | 249 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 250 | 250 | } |
| 251 | 251 | |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | foreach ( $new_values as $k => $v ) { |
| 255 | 255 | if ( is_array( $v ) ) { |
| 256 | 256 | if ( $k === 'default_value' ) { |
| 257 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 257 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 258 | 258 | } else { |
| 259 | - $new_values[ $k ] = serialize( $v ); |
|
| 259 | + $new_values[$k] = serialize( $v ); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | unset( $k, $v ); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | if ( $query_results ) { |
| 277 | 277 | if ( isset( $values['id'] ) ) { |
| 278 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 278 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | return $new_id; |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
| 339 | 339 | global $frm_duplicate_ids; |
| 340 | 340 | |
| 341 | - $where = array( |
|
| 341 | + $where = array( |
|
| 342 | 342 | array( |
| 343 | 343 | 'or' => 1, |
| 344 | 344 | 'fi.form_id' => $old_form_id, |
@@ -384,8 +384,8 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | $values = apply_filters( 'frm_duplicated_field', $values ); |
| 386 | 386 | $new_id = self::create( $values ); |
| 387 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 388 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 387 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 388 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 389 | 389 | unset( $field ); |
| 390 | 390 | } |
| 391 | 391 | } |
@@ -417,11 +417,11 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | // serialize array values |
| 419 | 419 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 420 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 420 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 421 | 421 | if ( 'field_options' === $opt ) { |
| 422 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
| 422 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
| 423 | 423 | } |
| 424 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 424 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | 'id' => $id, |
| 574 | 574 | 'field_key' => $id, |
| 575 | 575 | ); |
| 576 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 576 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | return $type; |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | continue; |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | - $fields[ $result->id ] = $result; |
|
| 602 | + $fields[$result->id] = $result; |
|
| 603 | 603 | $count ++; |
| 604 | 604 | if ( $limit == 1 ) { |
| 605 | 605 | $fields = $result; |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | $count = 0; |
| 646 | 646 | foreach ( $results as $result ) { |
| 647 | 647 | $count ++; |
| 648 | - $fields[ $result->id ] = $result; |
|
| 648 | + $fields[$result->id] = $result; |
|
| 649 | 649 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 650 | 650 | break; |
| 651 | 651 | } |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | if ( ! empty( $sub_fields ) ) { |
| 717 | - $index = $k + $index_offset; |
|
| 717 | + $index = $k + $index_offset; |
|
| 718 | 718 | $index_offset += count( $sub_fields ); |
| 719 | 719 | array_splice( $results, $index, 0, $sub_fields ); |
| 720 | 720 | } |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
| 760 | 760 | |
| 761 | 761 | if ( is_array( $where ) ) { |
| 762 | - $args = array( |
|
| 762 | + $args = array( |
|
| 763 | 763 | 'order_by' => $order_by, |
| 764 | 764 | 'limit' => $limit, |
| 765 | 765 | ); |
@@ -790,9 +790,9 @@ discard block |
||
| 790 | 790 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 791 | 791 | |
| 792 | 792 | self::prepare_options( $result ); |
| 793 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 794 | - $results[ $r_key ]->options = $result->options; |
|
| 795 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 793 | + $results[$r_key]->field_options = $result->field_options; |
|
| 794 | + $results[$r_key]->options = $result->options; |
|
| 795 | + $results[$r_key]->default_value = $result->default_value; |
|
| 796 | 796 | |
| 797 | 797 | unset( $r_key, $result ); |
| 798 | 798 | } |
@@ -994,23 +994,23 @@ discard block |
||
| 994 | 994 | } |
| 995 | 995 | |
| 996 | 996 | public static function is_option_true_in_array( $field, $option ) { |
| 997 | - return isset( $field[ $option ] ) && $field[ $option ]; |
|
| 997 | + return isset( $field[$option] ) && $field[$option]; |
|
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | public static function is_option_true_in_object( $field, $option ) { |
| 1001 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 1001 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | public static function is_option_empty_in_array( $field, $option ) { |
| 1005 | - return ! isset( $field[ $option ] ) || empty( $field[ $option ] ); |
|
| 1005 | + return ! isset( $field[$option] ) || empty( $field[$option] ); |
|
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | public static function is_option_empty_in_object( $field, $option ) { |
| 1009 | - return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] ); |
|
| 1009 | + return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] ); |
|
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | 1012 | public static function is_option_value_in_object( $field, $option ) { |
| 1013 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 1013 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | 1016 | /** |
@@ -1028,10 +1028,10 @@ discard block |
||
| 1028 | 1028 | |
| 1029 | 1029 | public static function get_option_in_array( $field, $option ) { |
| 1030 | 1030 | |
| 1031 | - if ( isset( $field[ $option ] ) ) { |
|
| 1032 | - $this_option = $field[ $option ]; |
|
| 1033 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
| 1034 | - $this_option = $field['field_options'][ $option ]; |
|
| 1031 | + if ( isset( $field[$option] ) ) { |
|
| 1032 | + $this_option = $field[$option]; |
|
| 1033 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
| 1034 | + $this_option = $field['field_options'][$option]; |
|
| 1035 | 1035 | } else { |
| 1036 | 1036 | $this_option = ''; |
| 1037 | 1037 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | public static function get_option_in_object( $field, $option ) { |
| 1043 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
| 1043 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
| 1044 | 1044 | } |
| 1045 | 1045 | |
| 1046 | 1046 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | 'fill' => '#4d4d4d', |
| 158 | 158 | 'orange' => '#f05a24', |
| 159 | 159 | ); |
| 160 | - $atts = array_merge( $defaults, $atts ); |
|
| 160 | + $atts = array_merge( $defaults, $atts ); |
|
| 161 | 161 | |
| 162 | 162 | return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 599.68 601.37" width="' . esc_attr( $atts['width'] ) . '" height="' . esc_attr( $atts['height'] ) . '"> |
| 163 | 163 | <path fill="' . esc_attr( $atts['orange'] ) . '" d="M289.6 384h140v76h-140z"/> |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | * @return string |
| 365 | 365 | */ |
| 366 | 366 | public static function get_server_value( $value ) { |
| 367 | - return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : ''; |
|
| 367 | + return isset( $_SERVER[$value] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[$value] ) ) : ''; |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | /** |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | ); |
| 388 | 388 | $ip = ''; |
| 389 | 389 | foreach ( $ip_options as $key ) { |
| 390 | - if ( ! isset( $_SERVER[ $key ] ) ) { |
|
| 390 | + if ( ! isset( $_SERVER[$key] ) ) { |
|
| 391 | 391 | continue; |
| 392 | 392 | } |
| 393 | 393 | |
@@ -412,10 +412,10 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | if ( $src == 'get' ) { |
| 414 | 414 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 415 | - $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); |
|
| 416 | - if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { |
|
| 415 | + $value = isset( $_POST[$param] ) ? wp_unslash( $_POST[$param] ) : ( isset( $_GET[$param] ) ? wp_unslash( $_GET[$param] ) : $default ); |
|
| 416 | + if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) { |
|
| 417 | 417 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 418 | - $value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) ); |
|
| 418 | + $value = htmlspecialchars_decode( wp_unslash( $_GET[$param] ) ); |
|
| 419 | 419 | } |
| 420 | 420 | self::sanitize_value( $sanitize, $value ); |
| 421 | 421 | } else { |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | $p = trim( $p, ']' ); |
| 439 | - $value = isset( $value[ $p ] ) ? $value[ $p ] : $default; |
|
| 439 | + $value = isset( $value[$p] ) ? $value[$p] : $default; |
|
| 440 | 440 | } |
| 441 | 441 | } |
| 442 | 442 | |
@@ -492,26 +492,26 @@ discard block |
||
| 492 | 492 | 'sanitize' => 'sanitize_text_field', |
| 493 | 493 | 'serialized' => false, |
| 494 | 494 | ); |
| 495 | - $args = wp_parse_args( $args, $defaults ); |
|
| 495 | + $args = wp_parse_args( $args, $defaults ); |
|
| 496 | 496 | |
| 497 | 497 | $value = $args['default']; |
| 498 | 498 | if ( $args['type'] == 'get' ) { |
| 499 | - if ( $_GET && isset( $_GET[ $args['param'] ] ) ) { |
|
| 499 | + if ( $_GET && isset( $_GET[$args['param']] ) ) { |
|
| 500 | 500 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 501 | - $value = wp_unslash( $_GET[ $args['param'] ] ); |
|
| 501 | + $value = wp_unslash( $_GET[$args['param']] ); |
|
| 502 | 502 | } |
| 503 | 503 | } elseif ( $args['type'] == 'post' ) { |
| 504 | - if ( isset( $_POST[ $args['param'] ] ) ) { |
|
| 504 | + if ( isset( $_POST[$args['param']] ) ) { |
|
| 505 | 505 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 506 | - $value = wp_unslash( $_POST[ $args['param'] ] ); |
|
| 506 | + $value = wp_unslash( $_POST[$args['param']] ); |
|
| 507 | 507 | if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) { |
| 508 | 508 | self::unserialize_or_decode( $value ); |
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | } else { |
| 512 | - if ( isset( $_REQUEST[ $args['param'] ] ) ) { |
|
| 512 | + if ( isset( $_REQUEST[$args['param']] ) ) { |
|
| 513 | 513 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 514 | - $value = wp_unslash( $_REQUEST[ $args['param'] ] ); |
|
| 514 | + $value = wp_unslash( $_REQUEST[$args['param']] ); |
|
| 515 | 515 | } |
| 516 | 516 | } |
| 517 | 517 | |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | if ( is_array( $value ) ) { |
| 544 | 544 | $temp_values = $value; |
| 545 | 545 | foreach ( $temp_values as $k => $v ) { |
| 546 | - self::sanitize_value( $sanitize, $value[ $k ] ); |
|
| 546 | + self::sanitize_value( $sanitize, $value[$k] ); |
|
| 547 | 547 | } |
| 548 | 548 | } else { |
| 549 | 549 | $value = call_user_func( $sanitize, $value ); |
@@ -554,8 +554,8 @@ discard block |
||
| 554 | 554 | public static function sanitize_request( $sanitize_method, &$values ) { |
| 555 | 555 | $temp_values = $values; |
| 556 | 556 | foreach ( $temp_values as $k => $val ) { |
| 557 | - if ( isset( $sanitize_method[ $k ] ) ) { |
|
| 558 | - $values[ $k ] = call_user_func( $sanitize_method[ $k ], $val ); |
|
| 557 | + if ( isset( $sanitize_method[$k] ) ) { |
|
| 558 | + $values[$k] = call_user_func( $sanitize_method[$k], $val ); |
|
| 559 | 559 | } |
| 560 | 560 | } |
| 561 | 561 | } |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | if ( is_array( $value ) ) { |
| 579 | 579 | $temp_values = $value; |
| 580 | 580 | foreach ( $temp_values as $k => $v ) { |
| 581 | - self::decode_specialchars( $value[ $k ] ); |
|
| 581 | + self::decode_specialchars( $value[$k] ); |
|
| 582 | 582 | } |
| 583 | 583 | } else { |
| 584 | 584 | self::decode_amp( $value ); |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | $allowed_html = $html; |
| 656 | 656 | } elseif ( ! empty( $allowed ) ) { |
| 657 | 657 | foreach ( (array) $allowed as $a ) { |
| 658 | - $allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array(); |
|
| 658 | + $allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array(); |
|
| 659 | 659 | } |
| 660 | 660 | } |
| 661 | 661 | |
@@ -830,8 +830,8 @@ discard block |
||
| 830 | 830 | } |
| 831 | 831 | |
| 832 | 832 | global $wp_query; |
| 833 | - if ( isset( $wp_query->query_vars[ $param ] ) ) { |
|
| 834 | - $value = $wp_query->query_vars[ $param ]; |
|
| 833 | + if ( isset( $wp_query->query_vars[$param] ) ) { |
|
| 834 | + $value = $wp_query->query_vars[$param]; |
|
| 835 | 835 | } |
| 836 | 836 | |
| 837 | 837 | return $value; |
@@ -1009,7 +1009,7 @@ discard block |
||
| 1009 | 1009 | 'new_file_path' => self::plugin_path() . '/js', |
| 1010 | 1010 | ) |
| 1011 | 1011 | ); |
| 1012 | - $new_file = new FrmCreateFile( $file_atts ); |
|
| 1012 | + $new_file = new FrmCreateFile( $file_atts ); |
|
| 1013 | 1013 | |
| 1014 | 1014 | $files = array( |
| 1015 | 1015 | self::plugin_path() . '/js/formidable.min.js', |
@@ -1414,8 +1414,8 @@ discard block |
||
| 1414 | 1414 | return $error; |
| 1415 | 1415 | } |
| 1416 | 1416 | |
| 1417 | - $nonce_value = ( $_REQUEST && isset( $_REQUEST[ $nonce_name ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $nonce_name ] ) ) : ''; |
|
| 1418 | - if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
| 1417 | + $nonce_value = ( $_REQUEST && isset( $_REQUEST[$nonce_name] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[$nonce_name] ) ) : ''; |
|
| 1418 | + if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
| 1419 | 1419 | $frm_settings = self::get_settings(); |
| 1420 | 1420 | $error = $frm_settings->admin_permission; |
| 1421 | 1421 | } |
@@ -1450,7 +1450,7 @@ discard block |
||
| 1450 | 1450 | } else { |
| 1451 | 1451 | foreach ( $value as $k => $v ) { |
| 1452 | 1452 | if ( ! is_array( $v ) ) { |
| 1453 | - $value[ $k ] = call_user_func( $original_function, $v ); |
|
| 1453 | + $value[$k] = call_user_func( $original_function, $v ); |
|
| 1454 | 1454 | } |
| 1455 | 1455 | } |
| 1456 | 1456 | } |
@@ -1475,7 +1475,7 @@ discard block |
||
| 1475 | 1475 | $return = array_merge( $return, self::array_flatten( $value, $keys ) ); |
| 1476 | 1476 | } else { |
| 1477 | 1477 | if ( $keys == 'keep' ) { |
| 1478 | - $return[ $key ] = $value; |
|
| 1478 | + $return[$key] = $value; |
|
| 1479 | 1479 | } else { |
| 1480 | 1480 | $return[] = $value; |
| 1481 | 1481 | } |
@@ -1539,11 +1539,11 @@ discard block |
||
| 1539 | 1539 | } |
| 1540 | 1540 | |
| 1541 | 1541 | $ver = $default; |
| 1542 | - if ( ! isset( $wp_scripts->registered[ $handle ] ) ) { |
|
| 1542 | + if ( ! isset( $wp_scripts->registered[$handle] ) ) { |
|
| 1543 | 1543 | return $ver; |
| 1544 | 1544 | } |
| 1545 | 1545 | |
| 1546 | - $query = $wp_scripts->registered[ $handle ]; |
|
| 1546 | + $query = $wp_scripts->registered[$handle]; |
|
| 1547 | 1547 | if ( is_object( $query ) && ! empty( $query->ver ) ) { |
| 1548 | 1548 | $ver = $query->ver; |
| 1549 | 1549 | } |
@@ -1720,7 +1720,7 @@ discard block |
||
| 1720 | 1720 | |
| 1721 | 1721 | foreach ( array( 'name', 'description' ) as $var ) { |
| 1722 | 1722 | $default_val = isset( $record->{$var} ) ? $record->{$var} : ''; |
| 1723 | - $values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
| 1723 | + $values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
| 1724 | 1724 | unset( $var, $default_val ); |
| 1725 | 1725 | } |
| 1726 | 1726 | |
@@ -1778,9 +1778,9 @@ discard block |
||
| 1778 | 1778 | } |
| 1779 | 1779 | } |
| 1780 | 1780 | |
| 1781 | - $field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type; |
|
| 1782 | - if ( isset( $post_values['item_meta'][ $field->id ] ) ) { |
|
| 1783 | - $new_value = $post_values['item_meta'][ $field->id ]; |
|
| 1781 | + $field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type; |
|
| 1782 | + if ( isset( $post_values['item_meta'][$field->id] ) ) { |
|
| 1783 | + $new_value = $post_values['item_meta'][$field->id]; |
|
| 1784 | 1784 | self::unserialize_or_decode( $new_value ); |
| 1785 | 1785 | } else { |
| 1786 | 1786 | $new_value = $meta_value; |
@@ -1801,7 +1801,7 @@ discard block |
||
| 1801 | 1801 | |
| 1802 | 1802 | $field_array = array_merge( (array) $field->field_options, $field_array ); |
| 1803 | 1803 | |
| 1804 | - $values['fields'][ $field->id ] = $field_array; |
|
| 1804 | + $values['fields'][$field->id] = $field_array; |
|
| 1805 | 1805 | } |
| 1806 | 1806 | |
| 1807 | 1807 | /** |
@@ -1848,11 +1848,11 @@ discard block |
||
| 1848 | 1848 | } |
| 1849 | 1849 | |
| 1850 | 1850 | foreach ( $form->options as $opt => $value ) { |
| 1851 | - if ( isset( $post_values[ $opt ] ) ) { |
|
| 1852 | - $values[ $opt ] = $post_values[ $opt ]; |
|
| 1853 | - self::unserialize_or_decode( $values[ $opt ] ); |
|
| 1851 | + if ( isset( $post_values[$opt] ) ) { |
|
| 1852 | + $values[$opt] = $post_values[$opt]; |
|
| 1853 | + self::unserialize_or_decode( $values[$opt] ); |
|
| 1854 | 1854 | } else { |
| 1855 | - $values[ $opt ] = $value; |
|
| 1855 | + $values[$opt] = $value; |
|
| 1856 | 1856 | } |
| 1857 | 1857 | } |
| 1858 | 1858 | |
@@ -1866,8 +1866,8 @@ discard block |
||
| 1866 | 1866 | $form_defaults = FrmFormsHelper::get_default_opts(); |
| 1867 | 1867 | |
| 1868 | 1868 | foreach ( $form_defaults as $opt => $default ) { |
| 1869 | - if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) { |
|
| 1870 | - $values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default; |
|
| 1869 | + if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) { |
|
| 1870 | + $values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default; |
|
| 1871 | 1871 | } |
| 1872 | 1872 | |
| 1873 | 1873 | unset( $opt, $default ); |
@@ -1878,8 +1878,8 @@ discard block |
||
| 1878 | 1878 | } |
| 1879 | 1879 | |
| 1880 | 1880 | foreach ( array( 'before', 'after', 'submit' ) as $h ) { |
| 1881 | - if ( ! isset( $values[ $h . '_html' ] ) ) { |
|
| 1882 | - $values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) ); |
|
| 1881 | + if ( ! isset( $values[$h . '_html'] ) ) { |
|
| 1882 | + $values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) ); |
|
| 1883 | 1883 | } |
| 1884 | 1884 | unset( $h ); |
| 1885 | 1885 | } |
@@ -2031,25 +2031,25 @@ discard block |
||
| 2031 | 2031 | if ( ! is_numeric( $levels ) ) { |
| 2032 | 2032 | // Show time in specified unit. |
| 2033 | 2033 | $levels = self::get_unit( $levels ); |
| 2034 | - if ( isset( $time_strings[ $levels ] ) ) { |
|
| 2034 | + if ( isset( $time_strings[$levels] ) ) { |
|
| 2035 | 2035 | $diff = array( |
| 2036 | 2036 | $levels => self::time_format( $levels, $diff ), |
| 2037 | 2037 | ); |
| 2038 | 2038 | $time_strings = array( |
| 2039 | - $levels => $time_strings[ $levels ], |
|
| 2039 | + $levels => $time_strings[$levels], |
|
| 2040 | 2040 | ); |
| 2041 | 2041 | } |
| 2042 | 2042 | $levels = 1; |
| 2043 | 2043 | } |
| 2044 | 2044 | |
| 2045 | 2045 | foreach ( $time_strings as $k => $v ) { |
| 2046 | - if ( isset( $diff[ $k ] ) && $diff[ $k ] ) { |
|
| 2047 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] ); |
|
| 2048 | - } elseif ( isset( $diff[ $k ] ) && count( $time_strings ) === 1 ) { |
|
| 2046 | + if ( isset( $diff[$k] ) && $diff[$k] ) { |
|
| 2047 | + $time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] ); |
|
| 2048 | + } elseif ( isset( $diff[$k] ) && count( $time_strings ) === 1 ) { |
|
| 2049 | 2049 | // Account for 0. |
| 2050 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . $v[1]; |
|
| 2050 | + $time_strings[$k] = $diff[$k] . ' ' . $v[1]; |
|
| 2051 | 2051 | } else { |
| 2052 | - unset( $time_strings[ $k ] ); |
|
| 2052 | + unset( $time_strings[$k] ); |
|
| 2053 | 2053 | } |
| 2054 | 2054 | } |
| 2055 | 2055 | |
@@ -2068,8 +2068,8 @@ discard block |
||
| 2068 | 2068 | 'y' => 'y', |
| 2069 | 2069 | 'd' => 'days', |
| 2070 | 2070 | ); |
| 2071 | - if ( isset( $return[ $unit ] ) ) { |
|
| 2072 | - return $diff[ $return[ $unit ] ]; |
|
| 2071 | + if ( isset( $return[$unit] ) ) { |
|
| 2072 | + return $diff[$return[$unit]]; |
|
| 2073 | 2073 | } |
| 2074 | 2074 | |
| 2075 | 2075 | $total = $diff['days'] * self::convert_time( 'd', $unit ); |
@@ -2077,11 +2077,11 @@ discard block |
||
| 2077 | 2077 | $times = array( 'h', 'i', 's' ); |
| 2078 | 2078 | |
| 2079 | 2079 | foreach ( $times as $time ) { |
| 2080 | - if ( ! isset( $diff[ $time ] ) ) { |
|
| 2080 | + if ( ! isset( $diff[$time] ) ) { |
|
| 2081 | 2081 | continue; |
| 2082 | 2082 | } |
| 2083 | 2083 | |
| 2084 | - $total += $diff[ $time ] * self::convert_time( $time, $unit ); |
|
| 2084 | + $total += $diff[$time] * self::convert_time( $time, $unit ); |
|
| 2085 | 2085 | } |
| 2086 | 2086 | |
| 2087 | 2087 | return floor( $total ); |
@@ -2101,7 +2101,7 @@ discard block |
||
| 2101 | 2101 | 'y' => DAY_IN_SECONDS * 365.25, |
| 2102 | 2102 | ); |
| 2103 | 2103 | |
| 2104 | - return $convert[ $from ] / $convert[ $to ]; |
|
| 2104 | + return $convert[$from] / $convert[$to]; |
|
| 2105 | 2105 | } |
| 2106 | 2106 | |
| 2107 | 2107 | /** |
@@ -2109,7 +2109,7 @@ discard block |
||
| 2109 | 2109 | */ |
| 2110 | 2110 | private static function get_unit( $unit ) { |
| 2111 | 2111 | $units = self::get_time_strings(); |
| 2112 | - if ( isset( $units[ $unit ] ) || is_numeric( $unit ) ) { |
|
| 2112 | + if ( isset( $units[$unit] ) || is_numeric( $unit ) ) { |
|
| 2113 | 2113 | return $unit; |
| 2114 | 2114 | } |
| 2115 | 2115 | |
@@ -2220,17 +2220,17 @@ discard block |
||
| 2220 | 2220 | |
| 2221 | 2221 | case 1: |
| 2222 | 2222 | $l2 = $name; |
| 2223 | - self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] ); |
|
| 2223 | + self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] ); |
|
| 2224 | 2224 | break; |
| 2225 | 2225 | |
| 2226 | 2226 | case 2: |
| 2227 | 2227 | $l3 = $name; |
| 2228 | - self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] ); |
|
| 2228 | + self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] ); |
|
| 2229 | 2229 | break; |
| 2230 | 2230 | |
| 2231 | 2231 | case 3: |
| 2232 | 2232 | $l4 = $name; |
| 2233 | - self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] ); |
|
| 2233 | + self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] ); |
|
| 2234 | 2234 | } |
| 2235 | 2235 | |
| 2236 | 2236 | unset( $this_val, $n ); |
@@ -2249,8 +2249,8 @@ discard block |
||
| 2249 | 2249 | public static function add_value_to_array( $name, $l1, $val, &$vars ) { |
| 2250 | 2250 | if ( $name == '' ) { |
| 2251 | 2251 | $vars[] = $val; |
| 2252 | - } elseif ( ! isset( $vars[ $l1 ] ) ) { |
|
| 2253 | - $vars[ $l1 ] = $val; |
|
| 2252 | + } elseif ( ! isset( $vars[$l1] ) ) { |
|
| 2253 | + $vars[$l1] = $val; |
|
| 2254 | 2254 | } |
| 2255 | 2255 | } |
| 2256 | 2256 | |
@@ -2266,7 +2266,7 @@ discard block |
||
| 2266 | 2266 | 'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ), |
| 2267 | 2267 | ); |
| 2268 | 2268 | |
| 2269 | - if ( ! isset( $tooltips[ $name ] ) ) { |
|
| 2269 | + if ( ! isset( $tooltips[$name] ) ) { |
|
| 2270 | 2270 | return; |
| 2271 | 2271 | } |
| 2272 | 2272 | |
@@ -2276,7 +2276,7 @@ discard block |
||
| 2276 | 2276 | echo ' class="frm_help"'; |
| 2277 | 2277 | } |
| 2278 | 2278 | |
| 2279 | - echo ' title="' . esc_attr( $tooltips[ $name ] ); |
|
| 2279 | + echo ' title="' . esc_attr( $tooltips[$name] ); |
|
| 2280 | 2280 | |
| 2281 | 2281 | if ( 'open' != $class ) { |
| 2282 | 2282 | echo '"'; |
@@ -2331,13 +2331,13 @@ discard block |
||
| 2331 | 2331 | } |
| 2332 | 2332 | |
| 2333 | 2333 | private static function prepare_action_slashes( $val, $key, &$post_content ) { |
| 2334 | - if ( ! isset( $post_content[ $key ] ) || is_numeric( $val ) ) { |
|
| 2334 | + if ( ! isset( $post_content[$key] ) || is_numeric( $val ) ) { |
|
| 2335 | 2335 | return; |
| 2336 | 2336 | } |
| 2337 | 2337 | |
| 2338 | 2338 | if ( is_array( $val ) ) { |
| 2339 | 2339 | foreach ( $val as $k1 => $v1 ) { |
| 2340 | - self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] ); |
|
| 2340 | + self::prepare_action_slashes( $v1, $k1, $post_content[$key] ); |
|
| 2341 | 2341 | unset( $k1, $v1 ); |
| 2342 | 2342 | } |
| 2343 | 2343 | } else { |
@@ -2345,7 +2345,7 @@ discard block |
||
| 2345 | 2345 | $val = stripslashes( $val ); |
| 2346 | 2346 | |
| 2347 | 2347 | // Add backslashes before double quotes and forward slashes only |
| 2348 | - $post_content[ $key ] = addcslashes( $val, '"\\/' ); |
|
| 2348 | + $post_content[$key] = addcslashes( $val, '"\\/' ); |
|
| 2349 | 2349 | } |
| 2350 | 2350 | } |
| 2351 | 2351 | |
@@ -2404,14 +2404,14 @@ discard block |
||
| 2404 | 2404 | continue; |
| 2405 | 2405 | } |
| 2406 | 2406 | $key = $input['name']; |
| 2407 | - if ( isset( $formatted[ $key ] ) ) { |
|
| 2408 | - if ( is_array( $formatted[ $key ] ) ) { |
|
| 2409 | - $formatted[ $key ][] = $input['value']; |
|
| 2407 | + if ( isset( $formatted[$key] ) ) { |
|
| 2408 | + if ( is_array( $formatted[$key] ) ) { |
|
| 2409 | + $formatted[$key][] = $input['value']; |
|
| 2410 | 2410 | } else { |
| 2411 | - $formatted[ $key ] = array( $formatted[ $key ], $input['value'] ); |
|
| 2411 | + $formatted[$key] = array( $formatted[$key], $input['value'] ); |
|
| 2412 | 2412 | } |
| 2413 | 2413 | } else { |
| 2414 | - $formatted[ $key ] = $input['value']; |
|
| 2414 | + $formatted[$key] = $input['value']; |
|
| 2415 | 2415 | } |
| 2416 | 2416 | } |
| 2417 | 2417 | |
@@ -2981,8 +2981,8 @@ discard block |
||
| 2981 | 2981 | } |
| 2982 | 2982 | |
| 2983 | 2983 | foreach ( $keys as $key ) { |
| 2984 | - if ( isset( $values[ $key ] ) ) { |
|
| 2985 | - $values[ $key ] = self::kses( $values[ $key ], 'all' ); |
|
| 2984 | + if ( isset( $values[$key] ) ) { |
|
| 2985 | + $values[$key] = self::kses( $values[$key], 'all' ); |
|
| 2986 | 2986 | } |
| 2987 | 2987 | } |
| 2988 | 2988 | |
@@ -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 | $errors['form'] = __( 'You do not have permission to do that', 'formidable' ); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | 'key_pointer' => '', // the pointer in the posted array |
| 88 | 88 | 'exclude' => array(), // exclude these field types from validation |
| 89 | 89 | ); |
| 90 | - $args = wp_parse_args( $args, $defaults ); |
|
| 90 | + $args = wp_parse_args( $args, $defaults ); |
|
| 91 | 91 | |
| 92 | 92 | if ( empty( $args['parent_field_id'] ) ) { |
| 93 | - $value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : ''; |
|
| 93 | + $value = isset( $values['item_meta'][$args['id']] ) ? $values['item_meta'][$args['id']] : ''; |
|
| 94 | 94 | } else { |
| 95 | 95 | // value is from a nested form |
| 96 | 96 | $value = $values; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 114 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 114 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 115 | 115 | } elseif ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { // WPCS: CSRF ok. |
| 116 | 116 | $_POST['item_name'] = $value; |
| 117 | 117 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $pattern = self::phone_format( $field ); |
| 167 | 167 | |
| 168 | 168 | if ( ! preg_match( $pattern, $value ) ) { |
| 169 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 169 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | |
| 467 | 467 | // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need. |
| 468 | 468 | if ( $include_value ) { |
| 469 | - $datas[ $key ] = $value; |
|
| 469 | + $datas[$key] = $value; |
|
| 470 | 470 | } |
| 471 | 471 | unset( $key, $value ); |
| 472 | 472 | } |
@@ -483,10 +483,10 @@ discard block |
||
| 483 | 483 | private static function add_comment_content_to_akismet( &$datas, $values ) { |
| 484 | 484 | if ( isset( $datas['frm_duplicated'] ) ) { |
| 485 | 485 | foreach ( $datas['frm_duplicated'] as $index ) { |
| 486 | - if ( isset( $values['item_meta'][ $index ] ) ) { |
|
| 487 | - unset( $values['item_meta'][ $index ] ); |
|
| 486 | + if ( isset( $values['item_meta'][$index] ) ) { |
|
| 487 | + unset( $values['item_meta'][$index] ); |
|
| 488 | 488 | } else { |
| 489 | - unset( $values[ $index ] ); |
|
| 489 | + unset( $values[$index] ); |
|
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | 492 | unset( $datas['frm_duplicated'] ); |
@@ -507,8 +507,8 @@ discard block |
||
| 507 | 507 | private static function skip_adding_values_to_akismet( &$values ) { |
| 508 | 508 | $skipped_field_ids = self::get_akismet_skipped_field_ids( $values ); |
| 509 | 509 | foreach ( $skipped_field_ids as $field_id ) { |
| 510 | - if ( isset( $values['item_meta'][ $field_id ] ) ) { |
|
| 511 | - unset( $values['item_meta'][ $field_id ] ); |
|
| 510 | + if ( isset( $values['item_meta'][$field_id] ) ) { |
|
| 511 | + unset( $values['item_meta'][$field_id] ); |
|
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | 514 | } |
@@ -575,14 +575,14 @@ discard block |
||
| 575 | 575 | continue; |
| 576 | 576 | } |
| 577 | 577 | |
| 578 | - if ( ! isset( $values['item_meta'][ $subsubindex ] ) ) { |
|
| 579 | - $values['item_meta'][ $subsubindex ] = array(); |
|
| 578 | + if ( ! isset( $values['item_meta'][$subsubindex] ) ) { |
|
| 579 | + $values['item_meta'][$subsubindex] = array(); |
|
| 580 | 580 | } |
| 581 | - $values['item_meta'][ $subsubindex ][] = $subsubvalue; |
|
| 581 | + $values['item_meta'][$subsubindex][] = $subsubvalue; |
|
| 582 | 582 | } |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | - unset( $values['item_meta'][ $field_id ] ); |
|
| 585 | + unset( $values['item_meta'][$field_id] ); |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | return $form_ids; |
@@ -112,7 +112,8 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 114 | 114 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
| 115 | - } elseif ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { // WPCS: CSRF ok. |
|
| 115 | + } elseif ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { |
|
| 116 | +// WPCS: CSRF ok. |
|
| 116 | 117 | $_POST['item_name'] = $value; |
| 117 | 118 | } |
| 118 | 119 | |
@@ -555,7 +556,8 @@ discard block |
||
| 555 | 556 | private static function get_all_form_ids_and_flatten_meta( &$values ) { |
| 556 | 557 | $form_ids = array( absint( $values['form_id'] ) ); |
| 557 | 558 | foreach ( $values['item_meta'] as $field_id => $value ) { |
| 558 | - if ( ! is_numeric( $field_id ) ) { // Maybe `other`. |
|
| 559 | + if ( ! is_numeric( $field_id ) ) { |
|
| 560 | +// Maybe `other`. |
|
| 559 | 561 | continue; |
| 560 | 562 | } |
| 561 | 563 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | '-' => 'down', |
| 195 | 195 | '+' => 'up', |
| 196 | 196 | ); |
| 197 | - $class = 'frm_arrow' . $arrow[ $icon ]; |
|
| 197 | + $class = 'frm_arrow' . $arrow[$icon]; |
|
| 198 | 198 | } else { |
| 199 | 199 | //frm_minus1_icon |
| 200 | 200 | $key = str_replace( 'p', '', $key ); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | '-' => 'minus', |
| 203 | 203 | '+' => 'plus', |
| 204 | 204 | ); |
| 205 | - $class = 'frm_' . $plus[ $icon ]; |
|
| 205 | + $class = 'frm_' . $plus[$icon]; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | if ( $key ) { |
@@ -222,8 +222,8 @@ discard block |
||
| 222 | 222 | ?> |
| 223 | 223 | <div class="btn-group" id="frm_<?php echo esc_attr( $name ); ?>_select"> |
| 224 | 224 | <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button"> |
| 225 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ); ?> |
|
| 226 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ); ?> |
|
| 225 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '+', $type ) ); ?> |
|
| 226 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '-', $type ) ); ?> |
|
| 227 | 227 | <b class="caret"></b> |
| 228 | 228 | </button> |
| 229 | 229 | <ul class="multiselect-container frm-dropdown-menu"> |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | <li <?php echo ( $style->post_content['collapse_icon'] == $key ) ? 'class="active"' : ''; ?>> |
| 232 | 232 | <a href="javascript:void(0);"> |
| 233 | 233 | <label> |
| 234 | - <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[ $name ], $key ); ?>/> |
|
| 234 | + <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[$name], $key ); ?>/> |
|
| 235 | 235 | <span> |
| 236 | 236 | <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '+', $type ) ); ?> |
| 237 | 237 | <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '-', $type ) ); ?> |
@@ -313,15 +313,15 @@ discard block |
||
| 313 | 313 | $vars = array_diff( $vars, $remove ); |
| 314 | 314 | |
| 315 | 315 | foreach ( $vars as $var ) { |
| 316 | - if ( ! isset( $settings[ $var ] ) ) { |
|
| 316 | + if ( ! isset( $settings[$var] ) ) { |
|
| 317 | 317 | continue; |
| 318 | 318 | } |
| 319 | - if ( ! isset( $defaults[ $var ] ) ) { |
|
| 320 | - $defaults[ $var ] = ''; |
|
| 319 | + if ( ! isset( $defaults[$var] ) ) { |
|
| 320 | + $defaults[$var] = ''; |
|
| 321 | 321 | } |
| 322 | - $show = empty( $defaults ) || ( $settings[ $var ] !== '' && $settings[ $var ] !== $defaults[ $var ] ); |
|
| 322 | + $show = empty( $defaults ) || ( $settings[$var] !== '' && $settings[$var] !== $defaults[$var] ); |
|
| 323 | 323 | if ( $show ) { |
| 324 | - echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[ $var ] ) : esc_html( $settings[ $var ] ) ) . ';'; // WPCS: XSS ok. |
|
| 324 | + echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[$var] ) : esc_html( $settings[$var] ) ) . ';'; // WPCS: XSS ok. |
|
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -370,8 +370,8 @@ discard block |
||
| 370 | 370 | |
| 371 | 371 | $checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' ); |
| 372 | 372 | foreach ( $checkbox_opts as $opt ) { |
| 373 | - if ( ! isset( $settings[ $opt ] ) ) { |
|
| 374 | - $settings[ $opt ] = 0; |
|
| 373 | + if ( ! isset( $settings[$opt] ) ) { |
|
| 374 | + $settings[$opt] = 0; |
|
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | |
@@ -401,10 +401,10 @@ discard block |
||
| 401 | 401 | $valid_keys = array_keys( $defaults ); |
| 402 | 402 | $sanitized_settings = array(); |
| 403 | 403 | foreach ( $valid_keys as $key ) { |
| 404 | - if ( isset( $settings[ $key ] ) ) { |
|
| 405 | - $sanitized_settings[ $key ] = sanitize_text_field( $settings[ $key ] ); |
|
| 404 | + if ( isset( $settings[$key] ) ) { |
|
| 405 | + $sanitized_settings[$key] = sanitize_text_field( $settings[$key] ); |
|
| 406 | 406 | } else { |
| 407 | - $sanitized_settings[ $key ] = $defaults[ $key ]; |
|
| 407 | + $sanitized_settings[$key] = $defaults[$key]; |
|
| 408 | 408 | } |
| 409 | 409 | } |
| 410 | 410 | return $sanitized_settings; |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | $css = ''; |
| 421 | 421 | } |
| 422 | 422 | foreach ( $opts as $opt ) { |
| 423 | - self::get_color_output( $css, $settings[ $opt ] ); |
|
| 423 | + self::get_color_output( $css, $settings[$opt] ); |
|
| 424 | 424 | } |
| 425 | 425 | } |
| 426 | 426 | } |
@@ -75,16 +75,16 @@ discard block |
||
| 75 | 75 | 'name' => sprintf( |
| 76 | 76 | /* translators: Formidable addon name */ |
| 77 | 77 | esc_html_x( 'Formidable %s', 'Formidable Addon Name', 'formidable' ), |
| 78 | - $addon_list[ $matching_addon ]['name'] |
|
| 78 | + $addon_list[$matching_addon]['name'] |
|
| 79 | 79 | ), |
| 80 | - 'addon' => $addon_list[ $matching_addon ]['slug'], |
|
| 81 | - 'short_description' => $addon_list[ $matching_addon ]['excerpt'], |
|
| 80 | + 'addon' => $addon_list[$matching_addon]['slug'], |
|
| 81 | + 'short_description' => $addon_list[$matching_addon]['excerpt'], |
|
| 82 | 82 | 'slug' => self::$slug, |
| 83 | - 'version' => $addon_list[ $matching_addon ]['version'], |
|
| 83 | + 'version' => $addon_list[$matching_addon]['version'], |
|
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | 86 | // Splice in the base addon data. |
| 87 | - $inject = array_merge( $inject, $addon_list[ $matching_addon ], $overrides ); |
|
| 87 | + $inject = array_merge( $inject, $addon_list[$matching_addon], $overrides ); |
|
| 88 | 88 | |
| 89 | 89 | // Add it to the top of the list. |
| 90 | 90 | array_unshift( $result->plugins, $inject ); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @return array |
| 137 | 137 | */ |
| 138 | 138 | private function get_addons() { |
| 139 | - $api = FrmFormApi::get_instance(); |
|
| 139 | + $api = FrmFormApi::get_instance(); |
|
| 140 | 140 | return $api->get_api_info(); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | |
| 342 | 342 | $all_plugins = get_plugins(); |
| 343 | 343 | |
| 344 | - return isset( $all_plugins[ $plugin ] ); |
|
| 344 | + return isset( $all_plugins[$plugin] ); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | $class = get_called_class(); |
| 48 | 48 | $key = $class . $license; |
| 49 | 49 | |
| 50 | - if ( ! isset( self::$instances[ $key ] ) ) { |
|
| 51 | - self::$instances[ $key ] = new $class( $license ); |
|
| 50 | + if ( ! isset( self::$instances[$key] ) ) { |
|
| 51 | + self::$instances[$key] = new $class( $license ); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - return self::$instances[ $key ]; |
|
| 54 | + return self::$instances[$key]; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Don't run the request again if it has already run and got no response. |
| 96 | - if ( isset( $this->has_run[ $url ] ) ) { |
|
| 96 | + if ( isset( $this->has_run[$url] ) ) { |
|
| 97 | 97 | return array(); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $agent = 'formidable-pro/' . FrmProDb::$plug_version; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $this->has_run[ $url ] = true; |
|
| 106 | + $this->has_run[$url] = true; |
|
| 107 | 107 | |
| 108 | 108 | $response = wp_remote_get( |
| 109 | 109 | $url, |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | $cats = array_intersect( $this->skip_categories(), $addon['categories'] ); |
| 128 | 128 | if ( ! empty( $cats ) ) { |
| 129 | - unset( $addons[ $k ] ); |
|
| 129 | + unset( $addons[$k] ); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | return $addon; |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | - } elseif ( isset( $addons[ $download_id ] ) ) { |
|
| 177 | - $plugin = $addons[ $download_id ]; |
|
| 176 | + } elseif ( isset( $addons[$download_id] ) ) { |
|
| 177 | + $plugin = $addons[$download_id]; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | return $plugin; |