@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param array $stats Statistics section data. |
141 | 141 | */ |
142 | 142 | protected function add_payments_data( &$stats ) { |
143 | - $payment_data = FrmEmailSummaryHelper::get_payments_data( $this->from_date, $this->to_date ); |
|
143 | + $payment_data = FrmEmailSummaryHelper::get_payments_data( $this->from_date, $this->to_date ); |
|
144 | 144 | $stats['payments_count'] = array( |
145 | 145 | 'label' => __( 'Payments collected', 'formidable' ), |
146 | 146 | 'count' => $payment_data['count'], |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // Build total for each currency. |
151 | 151 | foreach ( $payment_data['total'] as $currency => $amount ) { |
152 | - $stats[ 'payments_total_' . $currency ] = array( |
|
152 | + $stats['payments_total_' . $currency] = array( |
|
153 | 153 | // translators: currency name. |
154 | 154 | 'label' => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ), |
155 | 155 | 'count' => $amount, |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | if ( $this->has_comparison ) { |
162 | - $prev_payment_data = FrmEmailSummaryHelper::get_payments_data( $this->prev_from_date, $this->prev_to_date ); |
|
162 | + $prev_payment_data = FrmEmailSummaryHelper::get_payments_data( $this->prev_from_date, $this->prev_to_date ); |
|
163 | 163 | |
164 | 164 | if ( ! $payment_data['count'] && ! $prev_payment_data['count'] ) { |
165 | 165 | // Maybe this site doesn't collect payment, hide these sections. |
@@ -171,23 +171,23 @@ discard block |
||
171 | 171 | |
172 | 172 | // Compare total for each currency. |
173 | 173 | foreach ( $payment_data['total'] as $currency => $amount ) { |
174 | - if ( ! isset( $prev_payment_data['total'][ $currency ] ) ) { |
|
175 | - $stats[ 'payments_total_' . $currency ]['compare'] = 1; |
|
174 | + if ( ! isset( $prev_payment_data['total'][$currency] ) ) { |
|
175 | + $stats['payments_total_' . $currency]['compare'] = 1; |
|
176 | 176 | continue; |
177 | 177 | } |
178 | 178 | |
179 | - $stats[ 'payments_total_' . $currency ]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][ $currency ] ); |
|
180 | - unset( $prev_payment_data['total'][ $currency ] ); |
|
179 | + $stats['payments_total_' . $currency]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][$currency] ); |
|
180 | + unset( $prev_payment_data['total'][$currency] ); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // If prev month has more currencies. |
184 | 184 | foreach ( $prev_payment_data['total'] as $currency => $amount ) { |
185 | - $stats[ 'payments_total_' . $currency ] = array( |
|
185 | + $stats['payments_total_' . $currency] = array( |
|
186 | 186 | // translators: currency name. |
187 | 187 | 'label' => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ), |
188 | 188 | 'count' => 0, |
189 | 189 | 'display' => $this->get_formatted_price( 0, $currency ), |
190 | - 'compare' => -1, |
|
190 | + 'compare' => - 1, |
|
191 | 191 | ); |
192 | 192 | } |
193 | 193 | }//end if |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @param array $atts |
45 | 45 | */ |
46 | 46 | private function _set( $param, $atts ) { |
47 | - if ( isset( $atts[ $param ] ) ) { |
|
48 | - $this->{$param} = $atts[ $param ]; |
|
47 | + if ( isset( $atts[$param] ) ) { |
|
48 | + $this->{$param} = $atts[$param]; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | |
90 | 90 | $exclude = array( 'field_obj', 'html' ); |
91 | 91 | foreach ( $exclude as $ex ) { |
92 | - if ( isset( $atts[ $ex ] ) ) { |
|
93 | - unset( $this->pass_args[ $ex ] ); |
|
92 | + if ( isset( $atts[$ex] ) ) { |
|
93 | + unset( $this->pass_args[$ex] ); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * @param array $set |
103 | 103 | */ |
104 | 104 | private function set_from_field( $atts, $set ) { |
105 | - if ( isset( $atts[ $set['param'] ] ) ) { |
|
106 | - $this->{$set['param']} = $atts[ $set['param'] ]; |
|
105 | + if ( isset( $atts[$set['param']] ) ) { |
|
106 | + $this->{$set['param']} = $atts[$set['param']]; |
|
107 | 107 | } else { |
108 | 108 | $this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] ); |
109 | 109 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | private function replace_error_shortcode() { |
232 | 232 | $this->maybe_add_error_id(); |
233 | - $error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false; |
|
233 | + $error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false; |
|
234 | 234 | |
235 | 235 | if ( ! empty( $error ) && false === strpos( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) { |
236 | 236 | $error_body = self::get_error_body( $this->html ); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @since 3.06.02 |
272 | 272 | */ |
273 | 273 | private function maybe_add_error_id() { |
274 | - if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
274 | + if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
275 | 275 | return; |
276 | 276 | } |
277 | 277 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER ); |
352 | 352 | |
353 | 353 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
354 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
354 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
355 | 355 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
356 | 356 | |
357 | 357 | $replace_with = ''; |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $replace_with = $this->replace_input_shortcode( $shortcode_atts ); |
363 | 363 | } |
364 | 364 | |
365 | - $this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html ); |
|
365 | + $this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html ); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | unset( $shortcode_atts['class'] ); |
395 | 395 | } |
396 | 396 | |
397 | - $shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false'; |
|
397 | + $shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? 'true' : 'false'; |
|
398 | 398 | |
399 | 399 | $this->field_obj->set_field_column( 'shortcodes', $shortcode_atts ); |
400 | 400 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | */ |
447 | 447 | private function get_field_div_classes() { |
448 | 448 | // Add error class |
449 | - $classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : ''; |
|
449 | + $classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : ''; |
|
450 | 450 | |
451 | 451 | // Add label position class |
452 | 452 | $settings = $this->field_obj->display_field_settings(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | // Validate the number format. |
72 | 72 | if ( ! is_numeric( $args['value'] ) && '' !== $args['value'] ) { |
73 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
73 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // validate number settings |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | if ( $frm_settings->use_html && $maxnum !== '' && $minnum !== '' ) { |
83 | 83 | $value = (float) $args['value']; |
84 | 84 | if ( $value < $minnum ) { |
85 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' ); |
|
85 | + $errors['field' . $args['id']] = __( 'Please select a higher number', 'formidable' ); |
|
86 | 86 | } elseif ( $value > $maxnum ) { |
87 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a lower number', 'formidable' ); |
|
87 | + $errors['field' . $args['id']] = __( 'Please select a lower number', 'formidable' ); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return void |
106 | 106 | */ |
107 | 107 | private function validate_step( &$errors, $args ) { |
108 | - if ( isset( $errors[ 'field' . $args['id'] ] ) ) { |
|
108 | + if ( isset( $errors['field' . $args['id']] ) ) { |
|
109 | 109 | // Don't need to check if value is invalid before. |
110 | 110 | return; |
111 | 111 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | return; |
121 | 121 | } |
122 | 122 | |
123 | - $errors[ 'field' . $args['id'] ] = sprintf( |
|
123 | + $errors['field' . $args['id']] = sprintf( |
|
124 | 124 | // Translators: %1$s: the first nearest value; %2$s: the second nearest value. |
125 | 125 | __( 'Please enter a valid value. Two nearest valid values are %1$s and %2$s', 'formidable' ), |
126 | 126 | floatval( $result[0] ), |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function add_settings( $sections ) { |
185 | 185 | wp_enqueue_style( 'formidable-pro-fields' ); |
186 | - $sections[ $this->plugin_slug ] = array( |
|
186 | + $sections[$this->plugin_slug] = array( |
|
187 | 187 | 'class' => $this, |
188 | 188 | 'function' => 'settings_page', |
189 | 189 | 'name' => $this->plugin_name(), |
@@ -349,9 +349,9 @@ discard block |
||
349 | 349 | // Set the current step. |
350 | 350 | if ( ! isset( $step['current'] ) ) { |
351 | 351 | if ( $step['complete'] ) { |
352 | - $steps[ $k ]['current'] = false; |
|
352 | + $steps[$k]['current'] = false; |
|
353 | 353 | } else { |
354 | - $steps[ $k ]['current'] = ! $has_current; |
|
354 | + $steps[$k]['current'] = ! $has_current; |
|
355 | 355 | $has_current = true; |
356 | 356 | } |
357 | 357 | } elseif ( $step['current'] ) { |
@@ -361,10 +361,10 @@ discard block |
||
361 | 361 | // Set disabled buttons. |
362 | 362 | $class = isset( $step['button_class'] ) ? $step['button_class'] : ''; |
363 | 363 | $class .= ' button-primary frm-button-primary'; |
364 | - if ( ! $steps[ $k ]['current'] ) { |
|
364 | + if ( ! $steps[$k]['current'] ) { |
|
365 | 365 | $class .= ' frm_grey disabled'; |
366 | 366 | } |
367 | - $steps[ $k ]['button_class'] = $class; |
|
367 | + $steps[$k]['button_class'] = $class; |
|
368 | 368 | }//end foreach |
369 | 369 | |
370 | 370 | return $steps; |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | if ( $plugin['status'] === 'active' ) { |
392 | 392 | continue; |
393 | 393 | } |
394 | - $links[ $plugin_key ] = $plugin; |
|
394 | + $links[$plugin_key] = $plugin; |
|
395 | 395 | if ( isset( $plugin['url'] ) ) { |
396 | 396 | $rel[] = $plugin['url']; |
397 | 397 | } else { |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | $addons = $api->get_api_info(); |
521 | 521 | |
522 | 522 | $id = $this->download_id(); |
523 | - $has_file = isset( $addons[ $id ] ) && isset( $addons[ $id ]['beta'] ); |
|
523 | + $has_file = isset( $addons[$id] ) && isset( $addons[$id]['beta'] ); |
|
524 | 524 | |
525 | 525 | if ( ! $step['current'] ) { |
526 | 526 | ?> |
@@ -535,10 +535,10 @@ discard block |
||
535 | 535 | |
536 | 536 | if ( ! $has_file ) { |
537 | 537 | echo '<p class="frm_error_style">' . esc_html__( 'We didn\'t find anything to import. Please contact our team.', 'formidable' ) . '</p>'; |
538 | - } elseif ( ! isset( $addons[ $id ]['beta']['package'] ) ) { |
|
538 | + } elseif ( ! isset( $addons[$id]['beta']['package'] ) ) { |
|
539 | 539 | echo '<p class="frm_error_style">' . esc_html__( 'Looks like you may not have a current subscription for this solution. Please check your account.', 'formidable' ) . '</p>'; |
540 | 540 | } else { |
541 | - $xml = $addons[ $id ]['beta']['package']; |
|
541 | + $xml = $addons[$id]['beta']['package']; |
|
542 | 542 | if ( is_array( $xml ) ) { |
543 | 543 | $xml = reset( $xml ); |
544 | 544 | } |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | foreach ( $forms as $form ) { |
706 | 706 | $was_imported = isset( $form['form'] ) ? FrmForm::get_id_by_key( $form['form'] ) : false; |
707 | 707 | if ( $was_imported ) { |
708 | - $imported[ $form['form'] ] = $was_imported; |
|
708 | + $imported[$form['form']] = $was_imported; |
|
709 | 709 | } |
710 | 710 | } |
711 | 711 |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
273 | 273 | |
274 | 274 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
275 | - $new_values[ $col ] = $values[ $col ]; |
|
275 | + $new_values[$col] = $values[$col]; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | $new_values['options'] = self::maybe_filter_options( $values['options'] ); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
284 | 284 | |
285 | 285 | if ( isset( $values['id'] ) ) { |
286 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
286 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
287 | 287 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
288 | 288 | } |
289 | 289 | |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | foreach ( $new_values as $k => $v ) { |
293 | 293 | if ( is_array( $v ) ) { |
294 | 294 | if ( $k === 'default_value' ) { |
295 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
295 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
296 | 296 | } else { |
297 | - $new_values[ $k ] = serialize( $v ); |
|
297 | + $new_values[$k] = serialize( $v ); |
|
298 | 298 | } |
299 | 299 | } |
300 | 300 | unset( $k, $v ); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | } |
315 | 315 | |
316 | 316 | if ( isset( $values['id'] ) ) { |
317 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
317 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | return $new_id; |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
375 | 375 | global $frm_duplicate_ids; |
376 | 376 | |
377 | - $where = array( |
|
377 | + $where = array( |
|
378 | 378 | array( |
379 | 379 | 'or' => 1, |
380 | 380 | 'fi.form_id' => $old_form_id, |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | |
421 | 421 | $values = apply_filters( 'frm_duplicated_field', $values ); |
422 | 422 | $new_id = self::create( $values ); |
423 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
424 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
423 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
424 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
425 | 425 | unset( $field ); |
426 | 426 | }//end foreach |
427 | 427 | } |
@@ -459,11 +459,11 @@ discard block |
||
459 | 459 | |
460 | 460 | // serialize array values |
461 | 461 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
462 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
462 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
463 | 463 | if ( 'field_options' === $opt ) { |
464 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
464 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
465 | 465 | } |
466 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
466 | + $values[$opt] = serialize( $values[$opt] ); |
|
467 | 467 | } |
468 | 468 | } |
469 | 469 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | 'id' => $id, |
616 | 616 | 'field_key' => $id, |
617 | 617 | ); |
618 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
618 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | return $type; |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | continue; |
642 | 642 | } |
643 | 643 | |
644 | - $fields[ $result->id ] = $result; |
|
644 | + $fields[$result->id] = $result; |
|
645 | 645 | $count ++; |
646 | 646 | if ( $limit == 1 ) { |
647 | 647 | $fields = $result; |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | $count = 0; |
688 | 688 | foreach ( $results as $result ) { |
689 | 689 | $count ++; |
690 | - $fields[ $result->id ] = $result; |
|
690 | + $fields[$result->id] = $result; |
|
691 | 691 | if ( ! empty( $limit ) && $count >= $limit ) { |
692 | 692 | break; |
693 | 693 | } |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | } |
757 | 757 | |
758 | 758 | if ( ! empty( $sub_fields ) ) { |
759 | - $index = $k + $index_offset; |
|
759 | + $index = $k + $index_offset; |
|
760 | 760 | $index_offset += count( $sub_fields ); |
761 | 761 | array_splice( $results, $index, 0, $sub_fields ); |
762 | 762 | } |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
802 | 802 | |
803 | 803 | if ( is_array( $where ) ) { |
804 | - $args = array( |
|
804 | + $args = array( |
|
805 | 805 | 'order_by' => $order_by, |
806 | 806 | 'limit' => $limit, |
807 | 807 | ); |
@@ -832,9 +832,9 @@ discard block |
||
832 | 832 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
833 | 833 | |
834 | 834 | self::prepare_options( $result ); |
835 | - $results[ $r_key ]->field_options = $result->field_options; |
|
836 | - $results[ $r_key ]->options = $result->options; |
|
837 | - $results[ $r_key ]->default_value = $result->default_value; |
|
835 | + $results[$r_key]->field_options = $result->field_options; |
|
836 | + $results[$r_key]->options = $result->options; |
|
837 | + $results[$r_key]->default_value = $result->default_value; |
|
838 | 838 | |
839 | 839 | unset( $r_key, $result ); |
840 | 840 | } |
@@ -1037,23 +1037,23 @@ discard block |
||
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | public static function is_option_true_in_array( $field, $option ) { |
1040 | - return isset( $field[ $option ] ) && $field[ $option ]; |
|
1040 | + return isset( $field[$option] ) && $field[$option]; |
|
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | public static function is_option_true_in_object( $field, $option ) { |
1044 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
1044 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | public static function is_option_empty_in_array( $field, $option ) { |
1048 | - return ! isset( $field[ $option ] ) || empty( $field[ $option ] ); |
|
1048 | + return ! isset( $field[$option] ) || empty( $field[$option] ); |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | public static function is_option_empty_in_object( $field, $option ) { |
1052 | - return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] ); |
|
1052 | + return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] ); |
|
1053 | 1053 | } |
1054 | 1054 | |
1055 | 1055 | public static function is_option_value_in_object( $field, $option ) { |
1056 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
1056 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | /** |
@@ -1071,10 +1071,10 @@ discard block |
||
1071 | 1071 | |
1072 | 1072 | public static function get_option_in_array( $field, $option ) { |
1073 | 1073 | |
1074 | - if ( isset( $field[ $option ] ) ) { |
|
1075 | - $this_option = $field[ $option ]; |
|
1076 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
1077 | - $this_option = $field['field_options'][ $option ]; |
|
1074 | + if ( isset( $field[$option] ) ) { |
|
1075 | + $this_option = $field[$option]; |
|
1076 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
1077 | + $this_option = $field['field_options'][$option]; |
|
1078 | 1078 | } else { |
1079 | 1079 | $this_option = ''; |
1080 | 1080 | } |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | public static function get_option_in_object( $field, $option ) { |
1086 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
1086 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
1087 | 1087 | } |
1088 | 1088 | |
1089 | 1089 | /** |
@@ -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. |
@@ -941,8 +941,8 @@ discard block |
||
941 | 941 | self::maybe_get_form( $form ); |
942 | 942 | } |
943 | 943 | |
944 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
945 | - return $frm_vars['form_params'][ $form->id ]; |
|
944 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
945 | + return $frm_vars['form_params'][$form->id]; |
|
946 | 946 | } |
947 | 947 | |
948 | 948 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -971,15 +971,15 @@ discard block |
||
971 | 971 | // If there are two forms on the same page, make sure not to submit both. |
972 | 972 | foreach ( $default_values as $var => $default ) { |
973 | 973 | if ( $var == 'action' ) { |
974 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
974 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
975 | 975 | } else { |
976 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
976 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
977 | 977 | } |
978 | 978 | unset( $var, $default ); |
979 | 979 | } |
980 | 980 | } else { |
981 | 981 | foreach ( $default_values as $var => $default ) { |
982 | - $values[ $var ] = $default; |
|
982 | + $values[$var] = $default; |
|
983 | 983 | unset( $var, $default ); |
984 | 984 | } |
985 | 985 | } |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | 'sdir' => '', |
1006 | 1006 | ); |
1007 | 1007 | foreach ( $defaults as $var => $default ) { |
1008 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1008 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | 1011 | return $values; |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | 'keep_post' => '', |
1034 | 1034 | ); |
1035 | 1035 | foreach ( $defaults as $var => $default ) { |
1036 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1036 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | return $values; |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | $form = $atts['form']; |
1137 | 1137 | $default = isset( $atts['default'] ) ? $atts['default'] : ''; |
1138 | 1138 | |
1139 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; |
|
1139 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default; |
|
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | /** |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | |
6 | 6 | class FrmFormTemplateApi extends FrmFormApi { |
7 | 7 | |
8 | - protected static $code_option_name = 'frm_free_license_code'; |
|
8 | + protected static $code_option_name = 'frm_free_license_code'; |
|
9 | 9 | |
10 | 10 | private static $base_api_url = 'https://formidableforms.com/wp-json/form-templates/v1/'; |
11 | 11 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $templates = $this->get_api_info(); |
91 | 91 | $contact_form = 20872734; |
92 | - return isset( $templates[ $contact_form ] ) && ! empty( $templates[ $contact_form ]['url'] ); |
|
92 | + return isset( $templates[$contact_form] ) && ! empty( $templates[$contact_form]['url'] ); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -164,15 +164,15 @@ discard block |
||
164 | 164 | continue; |
165 | 165 | } |
166 | 166 | |
167 | - $data['urlByKey'][ $template['key'] ] = $template['url']; |
|
167 | + $data['urlByKey'][$template['key']] = $template['url']; |
|
168 | 168 | } |
169 | 169 | |
170 | - if ( ! isset( $data['urlByKey'][ $key ] ) ) { |
|
170 | + if ( ! isset( $data['urlByKey'][$key] ) ) { |
|
171 | 171 | $error = new WP_Error( 400, 'We were unable to retrieve the template' ); |
172 | 172 | wp_send_json_error( $error ); |
173 | 173 | } |
174 | 174 | |
175 | - $data['url'] = $data['urlByKey'][ $key ]; |
|
175 | + $data['url'] = $data['urlByKey'][$key]; |
|
176 | 176 | }//end if |
177 | 177 | |
178 | 178 | wp_send_json_success( $data ); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $to = $this->prepare_email_setting( $this->settings['email_to'], $user_id_args ); |
163 | 163 | $to = $this->explode_emails( $to ); |
164 | 164 | |
165 | - $where = array( |
|
165 | + $where = array( |
|
166 | 166 | 'it.field_id !' => 0, |
167 | 167 | 'it.item_id' => $this->entry->id, |
168 | 168 | ); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | 'entry' => $this->entry, |
173 | 173 | 'form' => $this->form, |
174 | 174 | ); |
175 | - $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
175 | + $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
176 | 176 | |
177 | 177 | $this->to = array_unique( (array) $to ); |
178 | 178 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | |
409 | 409 | // Add the user info if it isn't already included |
410 | 410 | if ( $this->include_user_info && $prev_mail_body === $mail_body ) { |
411 | - $data = $this->entry->description; |
|
411 | + $data = $this->entry->description; |
|
412 | 412 | $mail_body .= "\r\n\r\n" . __( 'User Information', 'formidable' ) . "\r\n"; |
413 | 413 | $this->maybe_add_ip( $mail_body ); |
414 | 414 | $mail_body .= __( 'User-Agent (Browser/OS)', 'formidable' ) . ': ' . FrmEntriesHelper::get_browser( $data['browser'] ) . "\r\n"; |
@@ -702,12 +702,12 @@ discard block |
||
702 | 702 | $name = trim( str_replace( $email, '', $val ) ); |
703 | 703 | } else { |
704 | 704 | // If user enters a name without an email |
705 | - unset( $recipients[ $key ] ); |
|
705 | + unset( $recipients[$key] ); |
|
706 | 706 | continue; |
707 | 707 | } |
708 | 708 | } |
709 | 709 | |
710 | - $recipients[ $key ] = $this->format_from_email( $name, $email ); |
|
710 | + $recipients[$key] = $this->format_from_email( $name, $email ); |
|
711 | 711 | }//end foreach |
712 | 712 | |
713 | 713 | return $recipients; |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | ); |
858 | 858 | |
859 | 859 | // Remove phone number from to addresses |
860 | - unset( $this->to[ $key ] ); |
|
860 | + unset( $this->to[$key] ); |
|
861 | 861 | }//end if |
862 | 862 | }//end foreach |
863 | 863 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | 'fill' => '#4d4d4d', |
199 | 199 | 'orange' => '#f05a24', |
200 | 200 | ); |
201 | - $atts = array_merge( $defaults, $atts ); |
|
201 | + $atts = array_merge( $defaults, $atts ); |
|
202 | 202 | |
203 | 203 | 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'] ) . '"> |
204 | 204 | <path fill="' . esc_attr( $atts['orange'] ) . '" d="M289.6 384h140v76h-140z"/> |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @return string |
406 | 406 | */ |
407 | 407 | public static function get_server_value( $value ) { |
408 | - return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : ''; |
|
408 | + return isset( $_SERVER[$value] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[$value] ) ) : ''; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $ip = ''; |
440 | 440 | |
441 | 441 | foreach ( $ip_options as $key ) { |
442 | - if ( ! isset( $_SERVER[ $key ] ) ) { |
|
442 | + if ( ! isset( $_SERVER[$key] ) ) { |
|
443 | 443 | continue; |
444 | 444 | } |
445 | 445 | |
@@ -508,10 +508,10 @@ discard block |
||
508 | 508 | } |
509 | 509 | |
510 | 510 | if ( $src === 'get' ) { |
511 | - $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
|
512 | - if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
511 | + $value = isset( $_POST[$param] ) ? wp_unslash( $_POST[$param] ) : ( isset( $_GET[$param] ) ? wp_unslash( $_GET[$param] ) : $default ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
|
512 | + if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
513 | 513 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
514 | - $value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) ); |
|
514 | + $value = htmlspecialchars_decode( wp_unslash( $_GET[$param] ) ); |
|
515 | 515 | } |
516 | 516 | self::sanitize_value( $sanitize, $value ); |
517 | 517 | } else { |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | } |
533 | 533 | |
534 | 534 | $p = trim( $p, ']' ); |
535 | - $value = isset( $value[ $p ] ) ? $value[ $p ] : $default; |
|
535 | + $value = isset( $value[$p] ) ? $value[$p] : $default; |
|
536 | 536 | } |
537 | 537 | } |
538 | 538 | |
@@ -588,26 +588,26 @@ discard block |
||
588 | 588 | 'sanitize' => 'sanitize_text_field', |
589 | 589 | 'serialized' => false, |
590 | 590 | ); |
591 | - $args = wp_parse_args( $args, $defaults ); |
|
591 | + $args = wp_parse_args( $args, $defaults ); |
|
592 | 592 | |
593 | 593 | $value = $args['default']; |
594 | 594 | if ( $args['type'] === 'get' ) { |
595 | - if ( $_GET && isset( $_GET[ $args['param'] ] ) ) { |
|
595 | + if ( $_GET && isset( $_GET[$args['param']] ) ) { |
|
596 | 596 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
597 | - $value = wp_unslash( $_GET[ $args['param'] ] ); |
|
597 | + $value = wp_unslash( $_GET[$args['param']] ); |
|
598 | 598 | } |
599 | 599 | } elseif ( $args['type'] === 'post' ) { |
600 | - if ( isset( $_POST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
600 | + if ( isset( $_POST[$args['param']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
601 | 601 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
602 | - $value = wp_unslash( $_POST[ $args['param'] ] ); |
|
602 | + $value = wp_unslash( $_POST[$args['param']] ); |
|
603 | 603 | if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) { |
604 | 604 | self::unserialize_or_decode( $value ); |
605 | 605 | } |
606 | 606 | } |
607 | 607 | } else { |
608 | - if ( isset( $_REQUEST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
608 | + if ( isset( $_REQUEST[$args['param']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
609 | 609 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
610 | - $value = wp_unslash( $_REQUEST[ $args['param'] ] ); |
|
610 | + $value = wp_unslash( $_REQUEST[$args['param']] ); |
|
611 | 611 | } |
612 | 612 | } |
613 | 613 | |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | if ( is_array( $value ) ) { |
640 | 640 | $temp_values = $value; |
641 | 641 | foreach ( $temp_values as $k => $v ) { |
642 | - self::sanitize_value( $sanitize, $value[ $k ] ); |
|
642 | + self::sanitize_value( $sanitize, $value[$k] ); |
|
643 | 643 | } |
644 | 644 | } else { |
645 | 645 | $value = call_user_func( $sanitize, $value ); |
@@ -650,8 +650,8 @@ discard block |
||
650 | 650 | public static function sanitize_request( $sanitize_method, &$values ) { |
651 | 651 | $temp_values = $values; |
652 | 652 | foreach ( $temp_values as $k => $val ) { |
653 | - if ( isset( $sanitize_method[ $k ] ) ) { |
|
654 | - $values[ $k ] = call_user_func( $sanitize_method[ $k ], $val ); |
|
653 | + if ( isset( $sanitize_method[$k] ) ) { |
|
654 | + $values[$k] = call_user_func( $sanitize_method[$k], $val ); |
|
655 | 655 | } |
656 | 656 | } |
657 | 657 | } |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | if ( is_array( $value ) ) { |
675 | 675 | $temp_values = $value; |
676 | 676 | foreach ( $temp_values as $k => $v ) { |
677 | - self::decode_specialchars( $value[ $k ] ); |
|
677 | + self::decode_specialchars( $value[$k] ); |
|
678 | 678 | } |
679 | 679 | } else { |
680 | 680 | self::decode_amp( $value ); |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | * @return array |
797 | 797 | */ |
798 | 798 | public static function add_allowed_submit_button_tags( $allowed_html ) { |
799 | - $allowed_html['input'] = array( |
|
799 | + $allowed_html['input'] = array( |
|
800 | 800 | 'type' => true, |
801 | 801 | 'value' => true, |
802 | 802 | 'formnovalidate' => true, |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | $allowed_html = $html; |
820 | 820 | } elseif ( ! empty( $allowed ) ) { |
821 | 821 | foreach ( (array) $allowed as $a ) { |
822 | - $allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array(); |
|
822 | + $allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array(); |
|
823 | 823 | } |
824 | 824 | } |
825 | 825 | |
@@ -998,8 +998,8 @@ discard block |
||
998 | 998 | } |
999 | 999 | |
1000 | 1000 | global $wp_query; |
1001 | - if ( isset( $wp_query->query_vars[ $param ] ) ) { |
|
1002 | - $value = $wp_query->query_vars[ $param ]; |
|
1001 | + if ( isset( $wp_query->query_vars[$param] ) ) { |
|
1002 | + $value = $wp_query->query_vars[$param]; |
|
1003 | 1003 | } |
1004 | 1004 | |
1005 | 1005 | return $value; |
@@ -1028,9 +1028,9 @@ discard block |
||
1028 | 1028 | 'frm_keyalt_icon' => 'frm_key_icon', |
1029 | 1029 | 'frm_keyalt_solid_icon' => 'frm_key_solid_icon', |
1030 | 1030 | ); |
1031 | - if ( isset( $deprecated[ $icon ] ) ) { |
|
1032 | - $icon = $deprecated[ $icon ]; |
|
1033 | - $class = str_replace( $icon, $deprecated[ $icon ], $class ); |
|
1031 | + if ( isset( $deprecated[$icon] ) ) { |
|
1032 | + $icon = $deprecated[$icon]; |
|
1033 | + $class = str_replace( $icon, $deprecated[$icon], $class ); |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | if ( $icon === $class ) { |
@@ -1363,7 +1363,7 @@ discard block |
||
1363 | 1363 | 'new_file_path' => self::plugin_path() . '/js', |
1364 | 1364 | ) |
1365 | 1365 | ); |
1366 | - $new_file = new FrmCreateFile( $file_atts ); |
|
1366 | + $new_file = new FrmCreateFile( $file_atts ); |
|
1367 | 1367 | |
1368 | 1368 | $files = array( |
1369 | 1369 | self::plugin_path() . '/js/formidable.min.js', |
@@ -1382,7 +1382,7 @@ discard block |
||
1382 | 1382 | 'new_file_path' => self::plugin_path() . '/js', |
1383 | 1383 | ) |
1384 | 1384 | ); |
1385 | - $new_file = new FrmCreateFile( $file_atts ); |
|
1385 | + $new_file = new FrmCreateFile( $file_atts ); |
|
1386 | 1386 | $files = array( |
1387 | 1387 | FrmStrpLiteAppHelper::plugin_path() . 'js/frmstrp.min.js', |
1388 | 1388 | ); |
@@ -1873,8 +1873,8 @@ discard block |
||
1873 | 1873 | return $error; |
1874 | 1874 | } |
1875 | 1875 | |
1876 | - $nonce_value = ( $_REQUEST && isset( $_REQUEST[ $nonce_name ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $nonce_name ] ) ) : ''; |
|
1877 | - if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
1876 | + $nonce_value = ( $_REQUEST && isset( $_REQUEST[$nonce_name] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[$nonce_name] ) ) : ''; |
|
1877 | + if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
1878 | 1878 | $frm_settings = self::get_settings(); |
1879 | 1879 | $error = $frm_settings->admin_permission; |
1880 | 1880 | } |
@@ -1909,7 +1909,7 @@ discard block |
||
1909 | 1909 | } else { |
1910 | 1910 | foreach ( $value as $k => $v ) { |
1911 | 1911 | if ( ! is_array( $v ) ) { |
1912 | - $value[ $k ] = call_user_func( $original_function, $v ); |
|
1912 | + $value[$k] = call_user_func( $original_function, $v ); |
|
1913 | 1913 | } |
1914 | 1914 | } |
1915 | 1915 | } |
@@ -1934,7 +1934,7 @@ discard block |
||
1934 | 1934 | $return = array_merge( $return, self::array_flatten( $value, $keys ) ); |
1935 | 1935 | } else { |
1936 | 1936 | if ( $keys === 'keep' ) { |
1937 | - $return[ $key ] = $value; |
|
1937 | + $return[$key] = $value; |
|
1938 | 1938 | } else { |
1939 | 1939 | $return[] = $value; |
1940 | 1940 | } |
@@ -1987,11 +1987,11 @@ discard block |
||
1987 | 1987 | } |
1988 | 1988 | |
1989 | 1989 | $ver = $default; |
1990 | - if ( ! isset( $wp_scripts->registered[ $handle ] ) ) { |
|
1990 | + if ( ! isset( $wp_scripts->registered[$handle] ) ) { |
|
1991 | 1991 | return $ver; |
1992 | 1992 | } |
1993 | 1993 | |
1994 | - $query = $wp_scripts->registered[ $handle ]; |
|
1994 | + $query = $wp_scripts->registered[$handle]; |
|
1995 | 1995 | if ( is_object( $query ) && ! empty( $query->ver ) ) { |
1996 | 1996 | $ver = $query->ver; |
1997 | 1997 | } |
@@ -2097,7 +2097,7 @@ discard block |
||
2097 | 2097 | $suffix = 2; |
2098 | 2098 | do { |
2099 | 2099 | $key_check = $key . $separator . $suffix; |
2100 | - ++$suffix; |
|
2100 | + ++ $suffix; |
|
2101 | 2101 | } while ( in_array( $key_check, $similar_keys, true ) ); |
2102 | 2102 | |
2103 | 2103 | $key = $key_check; |
@@ -2205,7 +2205,7 @@ discard block |
||
2205 | 2205 | |
2206 | 2206 | foreach ( array( 'name', 'description' ) as $var ) { |
2207 | 2207 | $default_val = isset( $record->{$var} ) ? $record->{$var} : ''; |
2208 | - $values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
2208 | + $values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
2209 | 2209 | unset( $var, $default_val ); |
2210 | 2210 | } |
2211 | 2211 | |
@@ -2263,9 +2263,9 @@ discard block |
||
2263 | 2263 | } |
2264 | 2264 | }//end if |
2265 | 2265 | |
2266 | - $field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type; |
|
2267 | - if ( isset( $post_values['item_meta'][ $field->id ] ) ) { |
|
2268 | - $new_value = $post_values['item_meta'][ $field->id ]; |
|
2266 | + $field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type; |
|
2267 | + if ( isset( $post_values['item_meta'][$field->id] ) ) { |
|
2268 | + $new_value = $post_values['item_meta'][$field->id]; |
|
2269 | 2269 | self::unserialize_or_decode( $new_value ); |
2270 | 2270 | } else { |
2271 | 2271 | $new_value = $meta_value; |
@@ -2286,7 +2286,7 @@ discard block |
||
2286 | 2286 | |
2287 | 2287 | $field_array = array_merge( (array) $field->field_options, $field_array ); |
2288 | 2288 | |
2289 | - $values['fields'][ $field->id ] = $field_array; |
|
2289 | + $values['fields'][$field->id] = $field_array; |
|
2290 | 2290 | } |
2291 | 2291 | |
2292 | 2292 | /** |
@@ -2336,11 +2336,11 @@ discard block |
||
2336 | 2336 | } |
2337 | 2337 | |
2338 | 2338 | foreach ( $form->options as $opt => $value ) { |
2339 | - if ( isset( $post_values[ $opt ] ) ) { |
|
2340 | - $values[ $opt ] = $post_values[ $opt ]; |
|
2341 | - self::unserialize_or_decode( $values[ $opt ] ); |
|
2339 | + if ( isset( $post_values[$opt] ) ) { |
|
2340 | + $values[$opt] = $post_values[$opt]; |
|
2341 | + self::unserialize_or_decode( $values[$opt] ); |
|
2342 | 2342 | } else { |
2343 | - $values[ $opt ] = $value; |
|
2343 | + $values[$opt] = $value; |
|
2344 | 2344 | } |
2345 | 2345 | } |
2346 | 2346 | |
@@ -2354,8 +2354,8 @@ discard block |
||
2354 | 2354 | $form_defaults = FrmFormsHelper::get_default_opts(); |
2355 | 2355 | |
2356 | 2356 | foreach ( $form_defaults as $opt => $default ) { |
2357 | - if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) { |
|
2358 | - $values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default; |
|
2357 | + if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) { |
|
2358 | + $values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default; |
|
2359 | 2359 | } |
2360 | 2360 | |
2361 | 2361 | unset( $opt, $default ); |
@@ -2366,8 +2366,8 @@ discard block |
||
2366 | 2366 | } |
2367 | 2367 | |
2368 | 2368 | foreach ( array( 'before', 'after', 'submit' ) as $h ) { |
2369 | - if ( ! isset( $values[ $h . '_html' ] ) ) { |
|
2370 | - $values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) ); |
|
2369 | + if ( ! isset( $values[$h . '_html'] ) ) { |
|
2370 | + $values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) ); |
|
2371 | 2371 | } |
2372 | 2372 | unset( $h ); |
2373 | 2373 | } |
@@ -2545,25 +2545,25 @@ discard block |
||
2545 | 2545 | if ( ! is_numeric( $levels ) ) { |
2546 | 2546 | // Show time in specified unit. |
2547 | 2547 | $levels = self::get_unit( $levels ); |
2548 | - if ( isset( $time_strings[ $levels ] ) ) { |
|
2548 | + if ( isset( $time_strings[$levels] ) ) { |
|
2549 | 2549 | $diff = array( |
2550 | 2550 | $levels => self::time_format( $levels, $diff ), |
2551 | 2551 | ); |
2552 | 2552 | $time_strings = array( |
2553 | - $levels => $time_strings[ $levels ], |
|
2553 | + $levels => $time_strings[$levels], |
|
2554 | 2554 | ); |
2555 | 2555 | } |
2556 | 2556 | $levels = 1; |
2557 | 2557 | } |
2558 | 2558 | |
2559 | 2559 | foreach ( $time_strings as $k => $v ) { |
2560 | - if ( isset( $diff[ $k ] ) && $diff[ $k ] ) { |
|
2561 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] ); |
|
2562 | - } elseif ( isset( $diff[ $k ] ) && count( $time_strings ) === 1 ) { |
|
2560 | + if ( isset( $diff[$k] ) && $diff[$k] ) { |
|
2561 | + $time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] ); |
|
2562 | + } elseif ( isset( $diff[$k] ) && count( $time_strings ) === 1 ) { |
|
2563 | 2563 | // Account for 0. |
2564 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . $v[1]; |
|
2564 | + $time_strings[$k] = $diff[$k] . ' ' . $v[1]; |
|
2565 | 2565 | } else { |
2566 | - unset( $time_strings[ $k ] ); |
|
2566 | + unset( $time_strings[$k] ); |
|
2567 | 2567 | } |
2568 | 2568 | } |
2569 | 2569 | |
@@ -2582,8 +2582,8 @@ discard block |
||
2582 | 2582 | 'y' => 'y', |
2583 | 2583 | 'd' => 'days', |
2584 | 2584 | ); |
2585 | - if ( isset( $return[ $unit ] ) ) { |
|
2586 | - return $diff[ $return[ $unit ] ]; |
|
2585 | + if ( isset( $return[$unit] ) ) { |
|
2586 | + return $diff[$return[$unit]]; |
|
2587 | 2587 | } |
2588 | 2588 | |
2589 | 2589 | $total = $diff['days'] * self::convert_time( 'd', $unit ); |
@@ -2591,11 +2591,11 @@ discard block |
||
2591 | 2591 | $times = array( 'h', 'i', 's' ); |
2592 | 2592 | |
2593 | 2593 | foreach ( $times as $time ) { |
2594 | - if ( ! isset( $diff[ $time ] ) ) { |
|
2594 | + if ( ! isset( $diff[$time] ) ) { |
|
2595 | 2595 | continue; |
2596 | 2596 | } |
2597 | 2597 | |
2598 | - $total += $diff[ $time ] * self::convert_time( $time, $unit ); |
|
2598 | + $total += $diff[$time] * self::convert_time( $time, $unit ); |
|
2599 | 2599 | } |
2600 | 2600 | |
2601 | 2601 | return floor( $total ); |
@@ -2615,7 +2615,7 @@ discard block |
||
2615 | 2615 | 'y' => DAY_IN_SECONDS * 365.25, |
2616 | 2616 | ); |
2617 | 2617 | |
2618 | - return $convert[ $from ] / $convert[ $to ]; |
|
2618 | + return $convert[$from] / $convert[$to]; |
|
2619 | 2619 | } |
2620 | 2620 | |
2621 | 2621 | /** |
@@ -2623,7 +2623,7 @@ discard block |
||
2623 | 2623 | */ |
2624 | 2624 | private static function get_unit( $unit ) { |
2625 | 2625 | $units = self::get_time_strings(); |
2626 | - if ( isset( $units[ $unit ] ) || is_numeric( $unit ) ) { |
|
2626 | + if ( isset( $units[$unit] ) || is_numeric( $unit ) ) { |
|
2627 | 2627 | return $unit; |
2628 | 2628 | } |
2629 | 2629 | |
@@ -2740,17 +2740,17 @@ discard block |
||
2740 | 2740 | |
2741 | 2741 | case 1: |
2742 | 2742 | $l2 = $name; |
2743 | - self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] ); |
|
2743 | + self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] ); |
|
2744 | 2744 | break; |
2745 | 2745 | |
2746 | 2746 | case 2: |
2747 | 2747 | $l3 = $name; |
2748 | - self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] ); |
|
2748 | + self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] ); |
|
2749 | 2749 | break; |
2750 | 2750 | |
2751 | 2751 | case 3: |
2752 | 2752 | $l4 = $name; |
2753 | - self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] ); |
|
2753 | + self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] ); |
|
2754 | 2754 | } |
2755 | 2755 | |
2756 | 2756 | unset( $this_val, $n ); |
@@ -2769,8 +2769,8 @@ discard block |
||
2769 | 2769 | public static function add_value_to_array( $name, $l1, $val, &$vars ) { |
2770 | 2770 | if ( $name == '' ) { |
2771 | 2771 | $vars[] = $val; |
2772 | - } elseif ( ! isset( $vars[ $l1 ] ) ) { |
|
2773 | - $vars[ $l1 ] = $val; |
|
2772 | + } elseif ( ! isset( $vars[$l1] ) ) { |
|
2773 | + $vars[$l1] = $val; |
|
2774 | 2774 | } |
2775 | 2775 | } |
2776 | 2776 | |
@@ -2787,7 +2787,7 @@ discard block |
||
2787 | 2787 | 'new_tab' => __( 'This option will open the link in a new browser tab. Please note that some popup blockers may prevent this from happening, in which case the link will be displayed.', 'formidable' ), |
2788 | 2788 | ); |
2789 | 2789 | |
2790 | - if ( ! isset( $tooltips[ $name ] ) ) { |
|
2790 | + if ( ! isset( $tooltips[$name] ) ) { |
|
2791 | 2791 | return; |
2792 | 2792 | } |
2793 | 2793 | |
@@ -2797,7 +2797,7 @@ discard block |
||
2797 | 2797 | echo ' class="frm_help"'; |
2798 | 2798 | } |
2799 | 2799 | |
2800 | - echo ' title="' . esc_attr( $tooltips[ $name ] ); |
|
2800 | + echo ' title="' . esc_attr( $tooltips[$name] ); |
|
2801 | 2801 | |
2802 | 2802 | if ( 'open' != $class ) { |
2803 | 2803 | echo '"'; |
@@ -2856,13 +2856,13 @@ discard block |
||
2856 | 2856 | } |
2857 | 2857 | |
2858 | 2858 | private static function prepare_action_slashes( $val, $key, &$post_content ) { |
2859 | - if ( ! isset( $post_content[ $key ] ) || is_numeric( $val ) ) { |
|
2859 | + if ( ! isset( $post_content[$key] ) || is_numeric( $val ) ) { |
|
2860 | 2860 | return; |
2861 | 2861 | } |
2862 | 2862 | |
2863 | 2863 | if ( is_array( $val ) ) { |
2864 | 2864 | foreach ( $val as $k1 => $v1 ) { |
2865 | - self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] ); |
|
2865 | + self::prepare_action_slashes( $v1, $k1, $post_content[$key] ); |
|
2866 | 2866 | unset( $k1, $v1 ); |
2867 | 2867 | } |
2868 | 2868 | } else { |
@@ -2870,7 +2870,7 @@ discard block |
||
2870 | 2870 | $val = stripslashes( $val ); |
2871 | 2871 | |
2872 | 2872 | // Add backslashes before double quotes and forward slashes only |
2873 | - $post_content[ $key ] = addcslashes( $val, '"\\/' ); |
|
2873 | + $post_content[$key] = addcslashes( $val, '"\\/' ); |
|
2874 | 2874 | } |
2875 | 2875 | } |
2876 | 2876 | |
@@ -2991,14 +2991,14 @@ discard block |
||
2991 | 2991 | continue; |
2992 | 2992 | } |
2993 | 2993 | $key = $input['name']; |
2994 | - if ( isset( $formatted[ $key ] ) ) { |
|
2995 | - if ( is_array( $formatted[ $key ] ) ) { |
|
2996 | - $formatted[ $key ][] = $input['value']; |
|
2994 | + if ( isset( $formatted[$key] ) ) { |
|
2995 | + if ( is_array( $formatted[$key] ) ) { |
|
2996 | + $formatted[$key][] = $input['value']; |
|
2997 | 2997 | } else { |
2998 | - $formatted[ $key ] = array( $formatted[ $key ], $input['value'] ); |
|
2998 | + $formatted[$key] = array( $formatted[$key], $input['value'] ); |
|
2999 | 2999 | } |
3000 | 3000 | } else { |
3001 | - $formatted[ $key ] = $input['value']; |
|
3001 | + $formatted[$key] = $input['value']; |
|
3002 | 3002 | } |
3003 | 3003 | } |
3004 | 3004 | |
@@ -3695,8 +3695,8 @@ discard block |
||
3695 | 3695 | } |
3696 | 3696 | |
3697 | 3697 | foreach ( $keys as $key ) { |
3698 | - if ( isset( $values[ $key ] ) ) { |
|
3699 | - $values[ $key ] = self::kses( $values[ $key ], 'all' ); |
|
3698 | + if ( isset( $values[$key] ) ) { |
|
3699 | + $values[$key] = self::kses( $values[$key], 'all' ); |
|
3700 | 3700 | } |
3701 | 3701 | } |
3702 | 3702 | |
@@ -3855,7 +3855,7 @@ discard block |
||
3855 | 3855 | return 0; |
3856 | 3856 | } |
3857 | 3857 | |
3858 | - return strlen( $parts[ count( $parts ) - 1 ] ); |
|
3858 | + return strlen( $parts[count( $parts ) - 1] ); |
|
3859 | 3859 | } |
3860 | 3860 | |
3861 | 3861 | /** |