@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | if ( $new_val !== $value ) { |
| 234 | - $new_values[ $key ] = $new_val; |
|
| 234 | + $new_values[$key] = $new_val; |
|
| 235 | 235 | } |
| 236 | 236 | }//end foreach |
| 237 | 237 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | foreach ( $values as $value_key => $value ) { |
| 270 | 270 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
| 271 | - $new_values[ $value_key ] = $value; |
|
| 271 | + $new_values[$value_key] = $value; |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
@@ -358,20 +358,20 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | foreach ( $all_fields as $fid ) { |
| 360 | 360 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
| 361 | - $values['item_meta'][ $fid->id ] = ''; |
|
| 361 | + $values['item_meta'][$fid->id] = ''; |
|
| 362 | 362 | } |
| 363 | - $field_array[ $fid->id ] = $fid; |
|
| 363 | + $field_array[$fid->id] = $fid; |
|
| 364 | 364 | } |
| 365 | 365 | unset( $all_fields ); |
| 366 | 366 | |
| 367 | 367 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 368 | - $field = $field_array[ $field_id ] ?? FrmField::getOne( $field_id ); |
|
| 368 | + $field = $field_array[$field_id] ?? FrmField::getOne( $field_id ); |
|
| 369 | 369 | |
| 370 | 370 | if ( ! $field ) { |
| 371 | 371 | continue; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
| 374 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
| 375 | 375 | |
| 376 | 376 | if ( $is_settings_page ) { |
| 377 | 377 | self::get_settings_page_html( $values, $field ); |
@@ -392,22 +392,22 @@ discard block |
||
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | foreach ( $update_options as $opt => $default ) { |
| 395 | - $field->field_options[ $opt ] = $values['field_options'][ $opt . '_' . $field_id ] ?? $default; |
|
| 396 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 395 | + $field->field_options[$opt] = $values['field_options'][$opt . '_' . $field_id] ?? $default; |
|
| 396 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 400 | 400 | |
| 401 | 401 | $new_field = array( |
| 402 | 402 | 'field_options' => $field->field_options, |
| 403 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 403 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 404 | 404 | ); |
| 405 | 405 | |
| 406 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 407 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 406 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
| 407 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 408 | 408 | if ( is_array( $option ) ) { |
| 409 | 409 | foreach ( $option as $key => $item ) { |
| 410 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 410 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | } |
@@ -438,8 +438,8 @@ discard block |
||
| 438 | 438 | */ |
| 439 | 439 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 440 | 440 | if ( $field->type === 'textarea' && |
| 441 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 442 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 441 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 442 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 443 | 443 | |
| 444 | 444 | $new_field['field_options']['max'] = ''; |
| 445 | 445 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
| 448 | 448 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
| 449 | 449 | */ |
| 450 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
| 450 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | |
@@ -528,11 +528,11 @@ discard block |
||
| 528 | 528 | * @return void |
| 529 | 529 | */ |
| 530 | 530 | private static function get_settings_page_html( $values, &$field ) { |
| 531 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 531 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 532 | 532 | $prev_opts = array(); |
| 533 | 533 | $fallback_html = $field->field_options['custom_html'] ?? FrmFieldsHelper::get_default_html( $field->type ); |
| 534 | 534 | |
| 535 | - $field->field_options['custom_html'] = $values['field_options'][ 'custom_html_' . $field->id ] ?? $fallback_html; |
|
| 535 | + $field->field_options['custom_html'] = $values['field_options']['custom_html_' . $field->id] ?? $fallback_html; |
|
| 536 | 536 | } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) { |
| 537 | 537 | $prev_opts = $field->field_options; |
| 538 | 538 | } |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | |
| 567 | 567 | foreach ( $field_cols as $col => $default ) { |
| 568 | 568 | $default = $default === '' ? $field->{$col} : $default; |
| 569 | - $new_field[ $col ] = $values['field_options'][ $col . '_' . $field->id ] ?? $default; |
|
| 569 | + $new_field[$col] = $values['field_options'][$col . '_' . $field->id] ?? $default; |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) { |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | self::destroy( $form->id ); |
| 776 | 776 | |
| 777 | 777 | if ( empty( $form->parent_form_id ) ) { |
| 778 | - ++$count; |
|
| 778 | + ++ $count; |
|
| 779 | 779 | } |
| 780 | 780 | } |
| 781 | 781 | |
@@ -1004,16 +1004,16 @@ discard block |
||
| 1004 | 1004 | foreach ( $results as $row ) { |
| 1005 | 1005 | if ( 'trash' != $row->status ) { |
| 1006 | 1006 | if ( $row->is_template ) { |
| 1007 | - ++$counts['template']; |
|
| 1007 | + ++ $counts['template']; |
|
| 1008 | 1008 | } else { |
| 1009 | - ++$counts['published']; |
|
| 1009 | + ++ $counts['published']; |
|
| 1010 | 1010 | } |
| 1011 | 1011 | } else { |
| 1012 | - ++$counts['trash']; |
|
| 1012 | + ++ $counts['trash']; |
|
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | if ( 'draft' == $row->status ) { |
| 1016 | - ++$counts['draft']; |
|
| 1016 | + ++ $counts['draft']; |
|
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | unset( $row ); |
@@ -1062,8 +1062,8 @@ discard block |
||
| 1062 | 1062 | self::maybe_get_form( $form ); |
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 1066 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 1065 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 1066 | + return $frm_vars['form_params'][$form->id]; |
|
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | 1069 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1093,15 +1093,15 @@ discard block |
||
| 1093 | 1093 | // If there are two forms on the same page, make sure not to submit both. |
| 1094 | 1094 | foreach ( $default_values as $var => $default ) { |
| 1095 | 1095 | if ( $var === 'action' ) { |
| 1096 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1096 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1097 | 1097 | } else { |
| 1098 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1098 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1099 | 1099 | } |
| 1100 | 1100 | unset( $var, $default ); |
| 1101 | 1101 | } |
| 1102 | 1102 | } else { |
| 1103 | 1103 | foreach ( $default_values as $var => $default ) { |
| 1104 | - $values[ $var ] = $default; |
|
| 1104 | + $values[$var] = $default; |
|
| 1105 | 1105 | unset( $var, $default ); |
| 1106 | 1106 | } |
| 1107 | 1107 | } |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | ); |
| 1132 | 1132 | |
| 1133 | 1133 | foreach ( $defaults as $var => $default ) { |
| 1134 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1134 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | return $values; |
@@ -1166,7 +1166,7 @@ discard block |
||
| 1166 | 1166 | ); |
| 1167 | 1167 | |
| 1168 | 1168 | foreach ( $defaults as $var => $default ) { |
| 1169 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1169 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1170 | 1170 | } |
| 1171 | 1171 | |
| 1172 | 1172 | return $values; |
@@ -1311,7 +1311,7 @@ discard block |
||
| 1311 | 1311 | $form = $atts['form']; |
| 1312 | 1312 | $default = $atts['default'] ?? ''; |
| 1313 | 1313 | |
| 1314 | - return $form->options[ $atts['option'] ] ?? $default; |
|
| 1314 | + return $form->options[$atts['option']] ?? $default; |
|
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | 1317 | /** |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | return $this->get_pagenum(); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - return $this->_pagination_args[ $key ] ?? null; |
|
| 249 | + return $this->_pagination_args[$key] ?? null; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | * @return void |
| 296 | 296 | */ |
| 297 | 297 | private function hidden_search_inputs( $param_name ) { |
| 298 | - if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
|
| 299 | - $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) ); |
|
| 298 | + if ( ! empty( $_REQUEST[$param_name] ) ) { |
|
| 299 | + $value = sanitize_text_field( wp_unslash( $_REQUEST[$param_name] ) ); |
|
| 300 | 300 | echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $value ) . '" />'; |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | echo "<ul class='subsubsub'>\n"; |
| 340 | 340 | |
| 341 | 341 | foreach ( $views as $class => $view ) { |
| 342 | - $views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 342 | + $views[$class] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 343 | 343 | } |
| 344 | 344 | echo implode( " |</li>\n", $views ) . "</li>\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 345 | 345 | echo '</ul>'; |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; |
| 510 | 510 | |
| 511 | 511 | foreach ( $actions as $action => $link ) { |
| 512 | - ++$i; |
|
| 512 | + ++ $i; |
|
| 513 | 513 | $sep = $i === $action_count ? '' : ' | '; |
| 514 | 514 | $out .= "<span class='$action'>$link$sep</span>"; |
| 515 | 515 | } |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | 'next' => __( 'Next page', 'formidable' ), |
| 748 | 748 | ); |
| 749 | 749 | |
| 750 | - return $labels[ $link ]; |
|
| 750 | + return $labels[$link]; |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | private function current_url() { |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | |
| 847 | 847 | // If the primary column doesn't exist fall back to the |
| 848 | 848 | // first non-checkbox column. |
| 849 | - if ( ! isset( $columns[ $default ] ) ) { |
|
| 849 | + if ( ! isset( $columns[$default] ) ) { |
|
| 850 | 850 | $default = self::get_default_primary_column_name(); |
| 851 | 851 | } |
| 852 | 852 | |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | */ |
| 861 | 861 | $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); |
| 862 | 862 | |
| 863 | - if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { |
|
| 863 | + if ( empty( $column ) || ! isset( $columns[$column] ) ) { |
|
| 864 | 864 | $column = $default; |
| 865 | 865 | } |
| 866 | 866 | |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); |
| 883 | 883 | |
| 884 | 884 | foreach ( $this->_column_headers as $key => $value ) { |
| 885 | - $column_headers[ $key ] = $value; |
|
| 885 | + $column_headers[$key] = $value; |
|
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | return $column_headers; |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | $data[1] = false; |
| 918 | 918 | } |
| 919 | 919 | |
| 920 | - $sortable[ $id ] = $data; |
|
| 920 | + $sortable[$id] = $data; |
|
| 921 | 921 | } |
| 922 | 922 | |
| 923 | 923 | $primary = $this->get_primary_column_name(); |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | static $cb_counter = 1; |
| 969 | 969 | $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', 'formidable' ) . '</label>'; |
| 970 | 970 | $columns['cb'] .= '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />'; |
| 971 | - ++$cb_counter; |
|
| 971 | + ++ $cb_counter; |
|
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | foreach ( $columns as $column_key => $column_display_name ) { |
@@ -990,8 +990,8 @@ discard block |
||
| 990 | 990 | $class[] = 'column-primary'; |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | - if ( isset( $sortable[ $column_key ] ) ) { |
|
| 994 | - list( $orderby, $desc_first ) = $sortable[ $column_key ]; |
|
| 993 | + if ( isset( $sortable[$column_key] ) ) { |
|
| 994 | + list( $orderby, $desc_first ) = $sortable[$column_key]; |
|
| 995 | 995 | |
| 996 | 996 | if ( $current_orderby == $orderby ) { |
| 997 | 997 | // The sorted column. The `aria-sort` attribute must be set only on the sorted column. |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | * @return bool Returns true if the setting is not set or if it is not false; otherwise, returns false. |
| 1112 | 1112 | */ |
| 1113 | 1113 | protected function should_display( $args, $settings ) { |
| 1114 | - return ! isset( $args[ $settings ] ) || false !== $args[ $settings ]; |
|
| 1114 | + return ! isset( $args[$settings] ) || false !== $args[$settings]; |
|
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | 1117 | /** |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | * @return array |
| 179 | 179 | */ |
| 180 | 180 | private function prepare_array_property( $index, $atts ) { |
| 181 | - if ( ! empty( $atts[ $index ] ) ) { |
|
| 182 | - return is_array( $atts[ $index ] ) ? $atts[ $index ] : explode( ',', $atts[ $index ] ); |
|
| 181 | + if ( ! empty( $atts[$index] ) ) { |
|
| 182 | + return is_array( $atts[$index] ) ? $atts[$index] : explode( ',', $atts[$index] ); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | return array(); |
@@ -256,11 +256,11 @@ discard block |
||
| 256 | 256 | ); |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - $ip = array( |
|
| 259 | + $ip = array( |
|
| 260 | 260 | 'label' => __( 'IP Address', 'formidable' ), |
| 261 | 261 | 'value' => $this->entry->ip, |
| 262 | 262 | ); |
| 263 | - $browser = array( |
|
| 263 | + $browser = array( |
|
| 264 | 264 | 'label' => __( 'User-Agent (Browser/OS)', 'formidable' ), |
| 265 | 265 | 'value' => isset( $entry_description['browser'] ) ? FrmEntriesHelper::get_browser( $entry_description['browser'] ) : '', |
| 266 | 266 | ); |
@@ -349,6 +349,6 @@ discard block |
||
| 349 | 349 | * @return void |
| 350 | 350 | */ |
| 351 | 351 | protected function add_field_values( $field ) { |
| 352 | - $this->field_values[ $field->id ] = new FrmFieldValue( $field, $this->entry ); |
|
| 352 | + $this->field_values[$field->id] = new FrmFieldValue( $field, $this->entry ); |
|
| 353 | 353 | } |
| 354 | 354 | } |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | // This may occasionally skip one level/order e.g. after adding a |
| 321 | 321 | // list field, as field_order would already be prepared to be used. |
| 322 | - ++$field_order; |
|
| 322 | + ++ $field_order; |
|
| 323 | 323 | |
| 324 | 324 | if ( ! empty( $new_field['fields'] ) && is_array( $new_field['fields'] ) ) { |
| 325 | 325 | // we have (inner) fields to merge |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $order = 0; |
| 372 | 372 | |
| 373 | 373 | foreach ( $fields as $field ) { |
| 374 | - ++$order; |
|
| 374 | + ++ $order; |
|
| 375 | 375 | $type = $this->get_field_type( $field ); |
| 376 | 376 | $new_type = $this->convert_field_type( $type, $field ); |
| 377 | 377 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $sub['name'] = __( 'Section Buttons', 'formidable' ); |
| 408 | 408 | $subs = array( $sub ); |
| 409 | 409 | $this->insert_fields_in_array( $subs, $order, 0, $fields ); |
| 410 | - ++$order; |
|
| 410 | + ++ $order; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | protected function create_fields( $form_id, &$form ) { |
| 522 | 522 | foreach ( $form['fields'] as $key => $new_field ) { |
| 523 | 523 | $new_field['form_id'] = $form_id; |
| 524 | - $form['fields'][ $key ]['id'] = FrmField::create( $new_field ); |
|
| 524 | + $form['fields'][$key]['id'] = FrmField::create( $new_field ); |
|
| 525 | 525 | } |
| 526 | 526 | } |
| 527 | 527 | |
@@ -564,9 +564,9 @@ discard block |
||
| 564 | 564 | } elseif ( $key === 'the_post_title' ) { |
| 565 | 565 | $new_action->post_content['post_title'] = $value; |
| 566 | 566 | } elseif ( is_string( $value ) ) { |
| 567 | - $new_action->post_content[ $key ] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 567 | + $new_action->post_content[$key] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 568 | 568 | } else { |
| 569 | - $new_action->post_content[ $key ] = $value; |
|
| 569 | + $new_action->post_content[$key] = $value; |
|
| 570 | 570 | } |
| 571 | 571 | } |
| 572 | 572 | |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | |
| 588 | 588 | $imported = $this->get_tracked_import(); |
| 589 | 589 | |
| 590 | - $imported[ $this->slug ][ $new_form_id ] = $source_id; |
|
| 590 | + $imported[$this->slug][$new_form_id] = $source_id; |
|
| 591 | 591 | |
| 592 | 592 | update_option( $this->tracking, $imported, false ); |
| 593 | 593 | } |
@@ -608,11 +608,11 @@ discard block |
||
| 608 | 608 | $imported = $this->get_tracked_import(); |
| 609 | 609 | $new_form_id = 0; |
| 610 | 610 | |
| 611 | - if ( ! isset( $imported[ $this->slug ] ) || ! in_array( $source_id, $imported[ $this->slug ] ) ) { |
|
| 611 | + if ( ! isset( $imported[$this->slug] ) || ! in_array( $source_id, $imported[$this->slug] ) ) { |
|
| 612 | 612 | return $new_form_id; |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - $new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) ); |
|
| 615 | + $new_form_id = array_search( $source_id, array_reverse( $imported[$this->slug], true ) ); |
|
| 616 | 616 | |
| 617 | 617 | if ( ! empty( $new_form_id ) && empty( FrmForm::get_key_by_id( $new_form_id ) ) ) { |
| 618 | 618 | // Allow reimport if the form was deleted. |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | if ( is_object( $this->field ) ) { |
| 172 | 172 | $field_val = $this->field->{$column}; |
| 173 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
| 174 | - $field_val = $this->field[ $column ]; |
|
| 173 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
| 174 | + $field_val = $this->field[$column]; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | return $field_val; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | if ( is_object( $this->field ) ) { |
| 188 | 188 | $this->field->{$column} = $value; |
| 189 | 189 | } elseif ( is_array( $this->field ) ) { |
| 190 | - $this->field[ $column ] = $value; |
|
| 190 | + $this->field[$column] = $value; |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | printf( |
| 731 | 731 | /* translators: %s: Field type */ |
| 732 | 732 | esc_html__( '%s Options', 'formidable' ), |
| 733 | - esc_html( $all_field_types[ $args['display']['type'] ]['name'] ) |
|
| 733 | + esc_html( $all_field_types[$args['display']['type']]['name'] ) |
|
| 734 | 734 | ); |
| 735 | 735 | FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown8_icon', array( 'aria-hidden' => 'true' ) ); |
| 736 | 736 | ?> |
@@ -872,8 +872,8 @@ discard block |
||
| 872 | 872 | |
| 873 | 873 | $fields = array_merge( $fields, $pro_fields ); |
| 874 | 874 | |
| 875 | - if ( isset( $fields[ $this->type ] ) ) { |
|
| 876 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
| 875 | + if ( isset( $fields[$this->type] ) ) { |
|
| 876 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
| 877 | 877 | } |
| 878 | 878 | |
| 879 | 879 | return $name; |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | * @return array |
| 891 | 891 | */ |
| 892 | 892 | public function get_default_field_options() { |
| 893 | - $opts = array( |
|
| 893 | + $opts = array( |
|
| 894 | 894 | 'size' => '', |
| 895 | 895 | 'max' => '', |
| 896 | 896 | 'label' => '', |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | * @return void |
| 1150 | 1150 | */ |
| 1151 | 1151 | public function set_aria_invalid_error( &$shortcode_atts, $args ) { |
| 1152 | - $shortcode_atts['aria-invalid'] = isset( $args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false'; |
|
| 1152 | + $shortcode_atts['aria-invalid'] = isset( $args['errors']['field' . $this->field_id] ) ? 'true' : 'false'; |
|
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | /** |
@@ -1342,11 +1342,11 @@ discard block |
||
| 1342 | 1342 | |
| 1343 | 1343 | $options = array_values( $this->field['options'] ); |
| 1344 | 1344 | |
| 1345 | - if ( ! isset( $options[ $opt ] ) ) { |
|
| 1345 | + if ( ! isset( $options[$opt] ) ) { |
|
| 1346 | 1346 | return $hidden; |
| 1347 | 1347 | } |
| 1348 | 1348 | |
| 1349 | - $option = $options[ $opt ]; |
|
| 1349 | + $option = $options[$opt]; |
|
| 1350 | 1350 | |
| 1351 | 1351 | if ( is_array( $option ) ) { |
| 1352 | 1352 | $option = $option['value']; |
@@ -1432,8 +1432,8 @@ discard block |
||
| 1432 | 1432 | $selected = $values['field_value']; |
| 1433 | 1433 | |
| 1434 | 1434 | if ( isset( $values['combo_name'] ) ) { |
| 1435 | - $options = $options[ $values['combo_name'] ]; |
|
| 1436 | - $selected = is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ? $selected[ $values['combo_name'] ] : ''; |
|
| 1435 | + $options = $options[$values['combo_name']]; |
|
| 1436 | + $selected = is_array( $selected ) && isset( $selected[$values['combo_name']] ) ? $selected[$values['combo_name']] : ''; |
|
| 1437 | 1437 | } |
| 1438 | 1438 | |
| 1439 | 1439 | $input = $this->select_tag( $values ); |
@@ -1504,7 +1504,7 @@ discard block |
||
| 1504 | 1504 | * @return array |
| 1505 | 1505 | */ |
| 1506 | 1506 | protected function fill_display_field_values( $args = array() ) { |
| 1507 | - $defaults = array( |
|
| 1507 | + $defaults = array( |
|
| 1508 | 1508 | 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
| 1509 | 1509 | 'field_id' => $this->get_field_column( 'id' ), |
| 1510 | 1510 | 'field_plus_id' => '', |
@@ -1565,7 +1565,7 @@ discard block |
||
| 1565 | 1565 | } |
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | - if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) && ! $custom_error_fields ) { |
|
| 1568 | + if ( isset( $args['errors']['field' . $args['field_id']] ) && ! $custom_error_fields ) { |
|
| 1569 | 1569 | if ( $error_comes_first ) { |
| 1570 | 1570 | array_unshift( $describedby, 'frm_error_' . $args['html_id'] ); |
| 1571 | 1571 | } else { |
@@ -1651,10 +1651,10 @@ discard block |
||
| 1651 | 1651 | $field_id = $this->get_field_column( 'id' ); |
| 1652 | 1652 | |
| 1653 | 1653 | if ( ! array_key_exists( $field_id, $frm_validated_unique_values ) ) { |
| 1654 | - $frm_validated_unique_values[ $field_id ] = array(); |
|
| 1654 | + $frm_validated_unique_values[$field_id] = array(); |
|
| 1655 | 1655 | return false; |
| 1656 | 1656 | } |
| 1657 | - return in_array( $value, $frm_validated_unique_values[ $field_id ], true ); |
|
| 1657 | + return in_array( $value, $frm_validated_unique_values[$field_id], true ); |
|
| 1658 | 1658 | } |
| 1659 | 1659 | |
| 1660 | 1660 | /** |
@@ -1682,7 +1682,7 @@ discard block |
||
| 1682 | 1682 | private function value_validated_as_unique( $value ) { |
| 1683 | 1683 | global $frm_validated_unique_values; |
| 1684 | 1684 | $field_id = $this->get_field_column( 'id' ); |
| 1685 | - $frm_validated_unique_values[ $field_id ][] = $value; |
|
| 1685 | + $frm_validated_unique_values[$field_id][] = $value; |
|
| 1686 | 1686 | } |
| 1687 | 1687 | |
| 1688 | 1688 | /** |
@@ -1728,8 +1728,8 @@ discard block |
||
| 1728 | 1728 | $value = $this->prepare_display_value( $value, $atts ); |
| 1729 | 1729 | |
| 1730 | 1730 | if ( is_array( $value ) ) { |
| 1731 | - if ( ! empty( $atts['show'] ) && isset( $value[ $atts['show'] ] ) ) { |
|
| 1732 | - $value = $value[ $atts['show'] ]; |
|
| 1731 | + if ( ! empty( $atts['show'] ) && isset( $value[$atts['show']] ) ) { |
|
| 1732 | + $value = $value[$atts['show']]; |
|
| 1733 | 1733 | } elseif ( empty( $atts['return_array'] ) ) { |
| 1734 | 1734 | $sep = $atts['sep'] ?? ', '; |
| 1735 | 1735 | $value = FrmAppHelper::safe_implode( $sep, $value ); |
@@ -1861,8 +1861,8 @@ discard block |
||
| 1861 | 1861 | $new_value = array(); |
| 1862 | 1862 | |
| 1863 | 1863 | foreach ( (array) $value as $old_child_id ) { |
| 1864 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
| 1865 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
| 1864 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
| 1865 | + $new_value[] = $saved_entries[$old_child_id]; |
|
| 1866 | 1866 | } |
| 1867 | 1867 | } |
| 1868 | 1868 | |
@@ -227,9 +227,9 @@ discard block |
||
| 227 | 227 | $groups = FrmFormActionsController::form_action_groups(); |
| 228 | 228 | $group = 'misc'; |
| 229 | 229 | |
| 230 | - if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) { |
|
| 230 | + if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) { |
|
| 231 | 231 | $group = $action_options['group']; |
| 232 | - } elseif ( isset( $groups[ $this->id_base ] ) ) { |
|
| 232 | + } elseif ( isset( $groups[$this->id_base] ) ) { |
|
| 233 | 233 | $group = $this->id_base; |
| 234 | 234 | } else { |
| 235 | 235 | foreach ( $groups as $name => $check_group ) { |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - $groups[ $group ]['id'] = $group; |
|
| 244 | - return $groups[ $group ]; |
|
| 243 | + $groups[$group]['id'] = $group; |
|
| 244 | + return $groups[$group]; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | * @return int $post_id |
| 367 | 367 | */ |
| 368 | 368 | public function maybe_create_action( $action, $forms ) { |
| 369 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] === 'updated' ) { |
|
| 369 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] === 'updated' ) { |
|
| 370 | 370 | // Update action only |
| 371 | 371 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
| 372 | 372 | return $this->save_settings( $action ); |
@@ -389,18 +389,18 @@ discard block |
||
| 389 | 389 | $switch = $this->get_global_switch_fields(); |
| 390 | 390 | |
| 391 | 391 | foreach ( (array) $action->post_content as $key => $val ) { |
| 392 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
| 393 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
| 392 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
| 393 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
| 394 | 394 | } elseif ( ! is_array( $val ) ) { |
| 395 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 396 | - } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
| 395 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 396 | + } elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
| 397 | 397 | // loop through each value if empty |
| 398 | - if ( empty( $switch[ $key ] ) ) { |
|
| 399 | - $switch[ $key ] = array_keys( $val ); |
|
| 398 | + if ( empty( $switch[$key] ) ) { |
|
| 399 | + $switch[$key] = array_keys( $val ); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - foreach ( $switch[ $key ] as $subkey ) { |
|
| 403 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
| 402 | + foreach ( $switch[$key] as $subkey ) { |
|
| 403 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | 406 | |
@@ -425,20 +425,20 @@ discard block |
||
| 425 | 425 | foreach ( $subkey as $subkey2 ) { |
| 426 | 426 | foreach ( (array) $val as $ck => $cv ) { |
| 427 | 427 | if ( is_array( $cv ) ) { |
| 428 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
| 429 | - } elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
| 430 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
| 428 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
| 429 | + } elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
| 430 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | } else { |
| 435 | 435 | foreach ( (array) $val as $ck => $cv ) { |
| 436 | 436 | if ( is_array( $cv ) ) { |
| 437 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
| 438 | - } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
| 439 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
| 437 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
| 438 | + } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
| 439 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
| 440 | 440 | } elseif ( $ck == $subkey ) { |
| 441 | - $action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] ); |
|
| 441 | + $action[$ck] = $this->maybe_switch_field_ids( $action[$ck] ); |
|
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | }//end if |
@@ -466,10 +466,10 @@ discard block |
||
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 469 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
| 469 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
| 470 | 470 | // Sanitizing removes scripts and <email> type of values. |
| 471 | 471 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
| 472 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
| 472 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
| 473 | 473 | } else { |
| 474 | 474 | return null; |
| 475 | 475 | } |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | foreach ( $settings as $number => $new_instance ) { |
| 480 | 480 | $this->_set( $number ); |
| 481 | 481 | |
| 482 | - $old_instance = $all_instances[ $number ] ?? array(); |
|
| 482 | + $old_instance = $all_instances[$number] ?? array(); |
|
| 483 | 483 | |
| 484 | 484 | if ( ! isset( $new_instance['post_status'] ) ) { |
| 485 | 485 | $new_instance['post_status'] = 'draft'; |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
| 519 | 519 | |
| 520 | 520 | if ( false !== $instance ) { |
| 521 | - $all_instances[ $number ] = $instance; |
|
| 521 | + $all_instances[$number] = $instance; |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | $action_ids[] = $this->save_settings( $instance ); |
@@ -629,12 +629,12 @@ discard block |
||
| 629 | 629 | // some plugins/themes are formatting the post_excerpt |
| 630 | 630 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
| 631 | 631 | |
| 632 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
| 632 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
| 633 | 633 | continue; |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
| 637 | - $settings[ $action->ID ] = $action; |
|
| 636 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
| 637 | + $settings[$action->ID] = $action; |
|
| 638 | 638 | |
| 639 | 639 | if ( count( $settings ) >= $limit ) { |
| 640 | 640 | break; |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | 'limit' => 99, |
| 685 | 685 | 'post_status' => $default_status, |
| 686 | 686 | ); |
| 687 | - $args = wp_parse_args( $args, $defaults ); |
|
| 687 | + $args = wp_parse_args( $args, $defaults ); |
|
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | /** |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | |
| 765 | 765 | $action = $this->prepare_action( $action ); |
| 766 | 766 | |
| 767 | - $settings[ $action->ID ] = $action; |
|
| 767 | + $settings[$action->ID] = $action; |
|
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | if ( 1 === $limit ) { |
@@ -812,10 +812,10 @@ discard block |
||
| 812 | 812 | |
| 813 | 813 | foreach ( $default_values as $k => $vals ) { |
| 814 | 814 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
| 815 | - if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
| 815 | + if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
| 816 | 816 | continue; |
| 817 | 817 | } |
| 818 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
| 818 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
| 819 | 819 | } |
| 820 | 820 | } |
| 821 | 821 | |
@@ -917,9 +917,9 @@ discard block |
||
| 917 | 917 | |
| 918 | 918 | // fill with existing options |
| 919 | 919 | foreach ( $action->post_content as $name => $val ) { |
| 920 | - if ( isset( $form->options[ $name ] ) ) { |
|
| 921 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
| 922 | - unset( $form->options[ $name ] ); |
|
| 920 | + if ( isset( $form->options[$name] ) ) { |
|
| 921 | + $action->post_content[$name] = $form->options[$name]; |
|
| 922 | + unset( $form->options[$name] ); |
|
| 923 | 923 | } |
| 924 | 924 | } |
| 925 | 925 | |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'include' ); |
| 1028 | 1028 | return array_filter( |
| 1029 | 1029 | $form_fields, |
| 1030 | - function ( $form_field ) { |
|
| 1030 | + function( $form_field ) { |
|
| 1031 | 1031 | return ! FrmField::is_no_save_field( $form_field->type ); |
| 1032 | 1032 | } |
| 1033 | 1033 | ); |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | 'description' => esc_html__( 'Just add your email address and you\'ll get 30+ free form templates to your account.', 'formidable' ), |
| 242 | 242 | 'submit_button_text' => esc_html_x( 'Get Templates', 'get free templates modal submit button text', 'formidable' ), |
| 243 | 243 | ); |
| 244 | - $view_parts[] = 'modals/leave-email-modal.php'; |
|
| 244 | + $view_parts[] = 'modals/leave-email-modal.php'; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // Add 'upgrade' modal view for non-elite users. |
@@ -340,12 +340,12 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | // Perform add or remove operation. |
| 342 | 342 | if ( 'add' === $operation ) { |
| 343 | - self::$favorite_templates[ $key ][] = $template_id; |
|
| 343 | + self::$favorite_templates[$key][] = $template_id; |
|
| 344 | 344 | } elseif ( 'remove' === $operation ) { |
| 345 | - $position = array_search( $template_id, self::$favorite_templates[ $key ], true ); |
|
| 345 | + $position = array_search( $template_id, self::$favorite_templates[$key], true ); |
|
| 346 | 346 | |
| 347 | 347 | if ( $position !== false ) { |
| 348 | - unset( self::$favorite_templates[ $key ][ $position ] ); |
|
| 348 | + unset( self::$favorite_templates[$key][$position] ); |
|
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | 351 | |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | foreach ( self::$templates as $key => &$template ) { |
| 504 | 504 | // Skip the template if the categories are not set. |
| 505 | 505 | if ( ! isset( $template['categories'] ) || ! isset( $template['id'] ) ) { |
| 506 | - unset( self::$templates[ $key ] ); |
|
| 506 | + unset( self::$templates[$key] ); |
|
| 507 | 507 | continue; |
| 508 | 508 | } |
| 509 | 509 | |
@@ -517,14 +517,12 @@ discard block |
||
| 517 | 517 | // Add the slug to the new array. |
| 518 | 518 | $template['category_slugs'][] = $category_slug; |
| 519 | 519 | |
| 520 | - if ( ! isset( self::$categories[ $category_slug ] ) ) { |
|
| 521 | - self::$categories[ $category_slug ] = array( |
|
| 520 | + if ( ! isset( self::$categories[$category_slug] ) ) { |
|
| 521 | + self::$categories[$category_slug] = array( |
|
| 522 | 522 | 'name' => $category, |
| 523 | 523 | 'count' => 0, |
| 524 | 524 | ); |
| 525 | - } |
|
| 526 | - |
|
| 527 | - ++self::$categories[ $category_slug ]['count']; |
|
| 525 | + } ++self::$categories[$category_slug]['count']; |
|
| 528 | 526 | } |
| 529 | 527 | |
| 530 | 528 | // Mark the template as favorite if it's in the favorite templates list. |
@@ -540,7 +538,7 @@ discard block |
||
| 540 | 538 | |
| 541 | 539 | foreach ( $redundant_cats as $redundant_cat ) { |
| 542 | 540 | $category_slug = sanitize_title( $redundant_cat ); |
| 543 | - unset( self::$categories[ $category_slug ] ); |
|
| 541 | + unset( self::$categories[$category_slug] ); |
|
| 544 | 542 | } |
| 545 | 543 | |
| 546 | 544 | // Sort the categories by keys alphabetically. |
@@ -589,9 +587,9 @@ discard block |
||
| 589 | 587 | */ |
| 590 | 588 | private static function assign_featured_templates() { |
| 591 | 589 | foreach ( self::FEATURED_TEMPLATES_IDS as $key ) { |
| 592 | - if ( isset( self::$templates[ $key ] ) ) { |
|
| 593 | - self::$templates[ $key ]['is_featured'] = true; |
|
| 594 | - self::$featured_templates[] = self::$templates[ $key ]; |
|
| 590 | + if ( isset( self::$templates[$key] ) ) { |
|
| 591 | + self::$templates[$key]['is_featured'] = true; |
|
| 592 | + self::$featured_templates[] = self::$templates[$key]; |
|
| 595 | 593 | } |
| 596 | 594 | } |
| 597 | 595 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | '<span class="frm-upgrade-submenu">' . esc_html( $cta_text ) . '</span>', |
| 120 | 120 | 'frm_view_forms', |
| 121 | 121 | 'formidable-pro-upgrade', |
| 122 | - function () { |
|
| 122 | + function() { |
|
| 123 | 123 | // This function doesn't need to do anything. |
| 124 | 124 | // The redirect is handled earlier to avoid issues with the headers being sent. |
| 125 | 125 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | unset( $addons['error'] ); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $pro = array( |
|
| 153 | + $pro = array( |
|
| 154 | 154 | 'pro' => array( |
| 155 | 155 | 'title' => 'Formidable Forms Pro', |
| 156 | 156 | 'slug' => 'formidable-pro', |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | // Extract the elements to move |
| 194 | 194 | foreach ( $plans as $plan ) { |
| 195 | - if ( isset( self::$categories[ $plan ] ) ) { |
|
| 196 | - $bottom_categories[ $plan ] = self::$categories[ $plan ]; |
|
| 197 | - unset( self::$categories[ $plan ] ); |
|
| 195 | + if ( isset( self::$categories[$plan] ) ) { |
|
| 196 | + $bottom_categories[$plan] = self::$categories[$plan]; |
|
| 197 | + unset( self::$categories[$plan] ); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
@@ -250,14 +250,12 @@ discard block |
||
| 250 | 250 | // Add the slug to the new array. |
| 251 | 251 | $addon['category-slugs'][] = $category_slug; |
| 252 | 252 | |
| 253 | - if ( ! isset( self::$categories[ $category_slug ] ) ) { |
|
| 254 | - self::$categories[ $category_slug ] = array( |
|
| 253 | + if ( ! isset( self::$categories[$category_slug] ) ) { |
|
| 254 | + self::$categories[$category_slug] = array( |
|
| 255 | 255 | 'name' => $category, |
| 256 | 256 | 'count' => 0, |
| 257 | 257 | ); |
| 258 | - } |
|
| 259 | - |
|
| 260 | - ++self::$categories[ $category_slug ]['count']; |
|
| 258 | + } ++self::$categories[$category_slug]['count']; |
|
| 261 | 259 | } |
| 262 | 260 | } |
| 263 | 261 | |
@@ -290,7 +288,7 @@ discard block |
||
| 290 | 288 | } else { |
| 291 | 289 | foreach ( $addons as $k => $addon ) { |
| 292 | 290 | if ( empty( $addon['excerpt'] ) && $k !== 'error' ) { |
| 293 | - unset( $addons[ $k ] ); |
|
| 291 | + unset( $addons[$k] ); |
|
| 294 | 292 | } |
| 295 | 293 | } |
| 296 | 294 | } |
@@ -405,7 +403,7 @@ discard block |
||
| 405 | 403 | |
| 406 | 404 | foreach ( $list as $k => $info ) { |
| 407 | 405 | $info['slug'] = $k; |
| 408 | - $list[ $k ] = array_merge( $defaults, $info ); |
|
| 406 | + $list[$k] = array_merge( $defaults, $info ); |
|
| 409 | 407 | } |
| 410 | 408 | return $list; |
| 411 | 409 | } |
@@ -575,17 +573,17 @@ discard block |
||
| 575 | 573 | continue; |
| 576 | 574 | } |
| 577 | 575 | |
| 578 | - $wp_plugin = $wp_plugins[ $folder ] ?? array(); |
|
| 576 | + $wp_plugin = $wp_plugins[$folder] ?? array(); |
|
| 579 | 577 | $wp_version = $wp_plugin['Version'] ?? '1.0'; |
| 580 | 578 | $plugin->slug = explode( '/', $folder )[0]; |
| 581 | 579 | |
| 582 | 580 | if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) { |
| 583 | - $transient->response[ $folder ] = $plugin; |
|
| 581 | + $transient->response[$folder] = $plugin; |
|
| 584 | 582 | } else { |
| 585 | - $transient->no_update[ $folder ] = $plugin; |
|
| 583 | + $transient->no_update[$folder] = $plugin; |
|
| 586 | 584 | } |
| 587 | 585 | |
| 588 | - $transient->checked[ $folder ] = $wp_version; |
|
| 586 | + $transient->checked[$folder] = $wp_version; |
|
| 589 | 587 | |
| 590 | 588 | }//end foreach |
| 591 | 589 | |
@@ -619,7 +617,7 @@ discard block |
||
| 619 | 617 | */ |
| 620 | 618 | protected static function is_installed( $plugin ) { |
| 621 | 619 | $all_plugins = self::get_plugins(); |
| 622 | - return isset( $all_plugins[ $plugin ] ); |
|
| 620 | + return isset( $all_plugins[$plugin] ); |
|
| 623 | 621 | } |
| 624 | 622 | |
| 625 | 623 | /** |
@@ -662,14 +660,14 @@ discard block |
||
| 662 | 660 | |
| 663 | 661 | $download_id = $plugin['id'] ?? 0; |
| 664 | 662 | |
| 665 | - if ( ! empty( $download_id ) && ! isset( $version_info[ $download_id ]['package'] ) ) { |
|
| 663 | + if ( ! empty( $download_id ) && ! isset( $version_info[$download_id]['package'] ) ) { |
|
| 666 | 664 | // if this addon is using its own license, get the update url |
| 667 | 665 | $addon_info = $api->get_api_info(); |
| 668 | 666 | |
| 669 | - $version_info[ $download_id ] = $addon_info[ $download_id ]; |
|
| 667 | + $version_info[$download_id] = $addon_info[$download_id]; |
|
| 670 | 668 | |
| 671 | 669 | if ( isset( $addon_info['error'] ) ) { |
| 672 | - $version_info[ $download_id ]['error'] = array( |
|
| 670 | + $version_info[$download_id]['error'] = array( |
|
| 673 | 671 | 'message' => $addon_info['error']['message'], |
| 674 | 672 | 'code' => $addon_info['error']['code'], |
| 675 | 673 | ); |
@@ -777,8 +775,8 @@ discard block |
||
| 777 | 775 | return $addon; |
| 778 | 776 | } |
| 779 | 777 | } |
| 780 | - } elseif ( isset( $addons[ $download_id ] ) ) { |
|
| 781 | - $plugin = $addons[ $download_id ]; |
|
| 778 | + } elseif ( isset( $addons[$download_id] ) ) { |
|
| 779 | + $plugin = $addons[$download_id]; |
|
| 782 | 780 | } |
| 783 | 781 | |
| 784 | 782 | return $plugin; |
@@ -849,7 +847,7 @@ discard block |
||
| 849 | 847 | self::set_addon_status( $addon ); |
| 850 | 848 | self::set_categories( $addon ); |
| 851 | 849 | |
| 852 | - $addons[ $id ] = $addon; |
|
| 850 | + $addons[$id] = $addon; |
|
| 853 | 851 | }//end foreach |
| 854 | 852 | } |
| 855 | 853 | |
@@ -1124,7 +1122,7 @@ discard block |
||
| 1124 | 1122 | */ |
| 1125 | 1123 | public static function ajax_activate_addon() { |
| 1126 | 1124 | self::process_addon_action( |
| 1127 | - function ( $plugin ) { |
|
| 1125 | + function( $plugin ) { |
|
| 1128 | 1126 | return self::handle_addon_action( $plugin, 'activate' ); |
| 1129 | 1127 | }, |
| 1130 | 1128 | array( 'FrmAddonsController', 'get_addon_activation_response' ) |
@@ -1149,7 +1147,7 @@ discard block |
||
| 1149 | 1147 | */ |
| 1150 | 1148 | public static function ajax_deactivate_addon() { |
| 1151 | 1149 | self::process_addon_action( |
| 1152 | - function ( $plugin ) { |
|
| 1150 | + function( $plugin ) { |
|
| 1153 | 1151 | return self::handle_addon_action( $plugin, 'deactivate' ); |
| 1154 | 1152 | } |
| 1155 | 1153 | ); |
@@ -1164,7 +1162,7 @@ discard block |
||
| 1164 | 1162 | */ |
| 1165 | 1163 | public static function ajax_uninstall_addon() { |
| 1166 | 1164 | self::process_addon_action( |
| 1167 | - function ( $plugin ) { |
|
| 1165 | + function( $plugin ) { |
|
| 1168 | 1166 | return self::handle_addon_action( $plugin, 'uninstall' ); |
| 1169 | 1167 | } |
| 1170 | 1168 | ); |
@@ -1571,7 +1569,7 @@ discard block |
||
| 1571 | 1569 | $addons = $api->get_api_info(); |
| 1572 | 1570 | |
| 1573 | 1571 | if ( is_array( $addons ) && array_key_exists( $addon_id, $addons ) ) { |
| 1574 | - $dates = $addons[ $addon_id ]; |
|
| 1572 | + $dates = $addons[$addon_id]; |
|
| 1575 | 1573 | $requires = FrmFormsHelper::get_plan_required( $dates ); |
| 1576 | 1574 | } |
| 1577 | 1575 | |
@@ -118,8 +118,8 @@ |
||
| 118 | 118 | $frm_inc_tax[] = $term->term_id; |
| 119 | 119 | ?> |
| 120 | 120 | <term><term_id><?php echo esc_html( $term->term_id ); ?></term_id><term_taxonomy><?php echo esc_html( $term->taxonomy ); ?></term_taxonomy><?php |
| 121 | - if ( ! empty( $parent_slugs[ $term->parent ] ) ) { |
|
| 122 | - echo '<term_parent>' . esc_html( $parent_slugs[ $term->parent ] ) . '</term_parent>'; |
|
| 121 | + if ( ! empty( $parent_slugs[$term->parent] ) ) { |
|
| 122 | + echo '<term_parent>' . esc_html( $parent_slugs[$term->parent] ) . '</term_parent>'; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if ( ! empty( $term->name ) ) { |