@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | $conditionally_add = array( 'include_fields', 'fields', 'exclude_fields', 'entry' ); |
| 163 | 163 | foreach ( $conditionally_add as $index ) { |
| 164 | - if ( isset( $atts[ $index ] ) ) { |
|
| 165 | - $entry_atts[ $index ] = $atts[ $index ]; |
|
| 164 | + if ( isset( $atts[$index] ) ) { |
|
| 165 | + $entry_atts[$index] = $atts[$index]; |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
@@ -331,8 +331,8 @@ discard block |
||
| 331 | 331 | |
| 332 | 332 | $unset = array( 'id', 'entry', 'form_id', 'format' ); |
| 333 | 333 | foreach ( $unset as $param ) { |
| 334 | - if ( isset( $atts[ $param ] ) ) { |
|
| 335 | - unset( $atts[ $param ] ); |
|
| 334 | + if ( isset( $atts[$param] ) ) { |
|
| 335 | + unset( $atts[$param] ); |
|
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | |
@@ -485,11 +485,11 @@ discard block |
||
| 485 | 485 | |
| 486 | 486 | $displayed_value = $this->prepare_display_value_for_array( $field_value->get_displayed_value() ); |
| 487 | 487 | |
| 488 | - $output[ $this->get_key_or_id( $field_value ) ] = $displayed_value; |
|
| 488 | + $output[$this->get_key_or_id( $field_value )] = $displayed_value; |
|
| 489 | 489 | |
| 490 | 490 | $has_separate_value = (bool) $field_value->get_field_option( 'separate_value' ); |
| 491 | 491 | if ( $has_separate_value || $displayed_value !== $field_value->get_saved_value() ) { |
| 492 | - $output[ $this->get_key_or_id( $field_value ) . '-value' ] = $field_value->get_saved_value(); |
|
| 492 | + $output[$this->get_key_or_id( $field_value ) . '-value'] = $field_value->get_saved_value(); |
|
| 493 | 493 | } |
| 494 | 494 | } |
| 495 | 495 | } |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | |
| 877 | 877 | if ( is_array( $value ) ) { |
| 878 | 878 | foreach ( $value as $key => $single_value ) { |
| 879 | - $value[ $key ] = $this->strip_html( $single_value ); |
|
| 879 | + $value[$key] = $this->strip_html( $single_value ); |
|
| 880 | 880 | } |
| 881 | 881 | } elseif ( $this->is_plain_text && ! is_array( $value ) ) { |
| 882 | 882 | if ( strpos( $value, '<img' ) !== false ) { |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | </h3> |
| 30 | 30 | <span class="frm_inbox_date"> |
| 31 | 31 | <?php |
| 32 | - if ( ! isset( $message['read'] ) || ! isset( $message['read'][ $user->ID ] ) ) { |
|
| 32 | + if ( ! isset( $message['read'] ) || ! isset( $message['read'][$user->ID] ) ) { |
|
| 33 | 33 | $inbox->mark_read( $key ); |
| 34 | 34 | ?> |
| 35 | 35 | <span class="frm_inbox_unread"></span> |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function add_settings( $sections ) { |
| 161 | 161 | wp_enqueue_style( 'formidable-pro-fields' ); |
| 162 | - $sections[ $this->plugin_slug ] = array( |
|
| 162 | + $sections[$this->plugin_slug] = array( |
|
| 163 | 163 | 'class' => $this, |
| 164 | 164 | 'function' => 'settings_page', |
| 165 | 165 | 'name' => $this->plugin_name(), |
@@ -316,9 +316,9 @@ discard block |
||
| 316 | 316 | // Set the current step. |
| 317 | 317 | if ( ! isset( $step['current'] ) ) { |
| 318 | 318 | if ( $step['complete'] ) { |
| 319 | - $steps[ $k ]['current'] = false; |
|
| 319 | + $steps[$k]['current'] = false; |
|
| 320 | 320 | } else { |
| 321 | - $steps[ $k ]['current'] = ! $has_current; |
|
| 321 | + $steps[$k]['current'] = ! $has_current; |
|
| 322 | 322 | $has_current = true; |
| 323 | 323 | } |
| 324 | 324 | } elseif ( $step['current'] ) { |
@@ -328,10 +328,10 @@ discard block |
||
| 328 | 328 | // Set disabled buttons. |
| 329 | 329 | $class = isset( $step['button_class'] ) ? $step['button_class'] : ''; |
| 330 | 330 | $class .= ' button-primary frm-button-primary'; |
| 331 | - if ( ! $steps[ $k ]['current'] ) { |
|
| 331 | + if ( ! $steps[$k]['current'] ) { |
|
| 332 | 332 | $class .= ' frm_grey disabled'; |
| 333 | 333 | } |
| 334 | - $steps[ $k ]['button_class'] = $class; |
|
| 334 | + $steps[$k]['button_class'] = $class; |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | return $steps; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | if ( $plugin['status'] === 'active' ) { |
| 354 | 354 | continue; |
| 355 | 355 | } |
| 356 | - $links[ $plugin_key ] = $plugin; |
|
| 356 | + $links[$plugin_key] = $plugin; |
|
| 357 | 357 | if ( isset( $plugin['url'] ) ) { |
| 358 | 358 | $rel[] = $plugin['url']; |
| 359 | 359 | } else { |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $addons = $api->get_api_info(); |
| 469 | 469 | |
| 470 | 470 | $id = $this->download_id(); |
| 471 | - $has_file = isset( $addons[ $id ] ) && isset( $addons[ $id ]['beta'] ); |
|
| 471 | + $has_file = isset( $addons[$id] ) && isset( $addons[$id]['beta'] ); |
|
| 472 | 472 | |
| 473 | 473 | if ( ! $step['current'] ) { |
| 474 | 474 | ?> |
@@ -483,10 +483,10 @@ discard block |
||
| 483 | 483 | |
| 484 | 484 | if ( ! $has_file ) { |
| 485 | 485 | echo '<p class="frm_error_style">' . esc_html__( 'We didn\'t find anything to import. Please contact our team.', 'formidable' ) . '</p>'; |
| 486 | - } elseif ( ! isset( $addons[ $id ]['beta']['package'] ) ) { |
|
| 486 | + } elseif ( ! isset( $addons[$id]['beta']['package'] ) ) { |
|
| 487 | 487 | 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>'; |
| 488 | 488 | } else { |
| 489 | - $xml = $addons[ $id ]['beta']['package']; |
|
| 489 | + $xml = $addons[$id]['beta']['package']; |
|
| 490 | 490 | if ( is_array( $xml ) ) { |
| 491 | 491 | $xml = reset( $xml ); |
| 492 | 492 | } |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | foreach ( $forms as $form ) { |
| 625 | 625 | $was_imported = isset( $form['form'] ) ? FrmForm::get_id_by_key( $form['form'] ) : false; |
| 626 | 626 | if ( $was_imported ) { |
| 627 | - $imported[ $form['form'] ] = $was_imported; |
|
| 627 | + $imported[$form['form']] = $was_imported; |
|
| 628 | 628 | } |
| 629 | 629 | } |
| 630 | 630 | |
@@ -42,7 +42,8 @@ |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // Only do this for single site installs. |
| 45 | - if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 45 | + if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { |
|
| 46 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 46 | 47 | return; |
| 47 | 48 | } |
| 48 | 49 | |
@@ -9,6 +9,6 @@ |
||
| 9 | 9 | $type = $field['type']; |
| 10 | 10 | do_action( 'frm_after_checkbox', compact( 'field', 'field_name', 'type' ) ); |
| 11 | 11 | } else { |
| 12 | - $read_only = $field['read_only']; |
|
| 12 | + $read_only = $field['read_only']; |
|
| 13 | 13 | include dirname( __FILE__ ) . '/' . $field['type'] . '-field.php'; |
| 14 | 14 | } |
@@ -283,7 +283,7 @@ |
||
| 283 | 283 | 'content' => 'upgrade', |
| 284 | 284 | ) |
| 285 | 285 | ); |
| 286 | - $renew_link = FrmAppHelper::admin_upgrade_link( |
|
| 286 | + $renew_link = FrmAppHelper::admin_upgrade_link( |
|
| 287 | 287 | array( |
| 288 | 288 | 'medium' => 'new-template', |
| 289 | 289 | 'content' => 'renew', |
@@ -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 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | $templates = $this->get_api_info(); |
| 78 | 78 | $contact_form = 20872734; |
| 79 | - return isset( $templates[ $contact_form ] ) && ! empty( $templates[ $contact_form ]['url'] ); |
|
| 79 | + return isset( $templates[$contact_form] ) && ! empty( $templates[$contact_form]['url'] ); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -137,15 +137,15 @@ discard block |
||
| 137 | 137 | continue; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - $data['urlByKey'][ $template['key'] ] = $template['url']; |
|
| 140 | + $data['urlByKey'][$template['key']] = $template['url']; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if ( ! isset( $data['urlByKey'][ $key ] ) ) { |
|
| 143 | + if ( ! isset( $data['urlByKey'][$key] ) ) { |
|
| 144 | 144 | $error = new WP_Error( 400, 'We were unable to retrieve the template' ); |
| 145 | 145 | wp_send_json_error( $error ); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $data['url'] = $data['urlByKey'][ $key ]; |
|
| 148 | + $data['url'] = $data['urlByKey'][$key]; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | wp_send_json_success( $data ); |
@@ -39,7 +39,8 @@ |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | foreach ( $sub_field['options'] as $option ) { |
| 42 | - if ( 'default_value' === $option ) { // We parse default value from field column. |
|
| 42 | + if ( 'default_value' === $option ) { |
|
| 43 | +// We parse default value from field column. |
|
| 43 | 44 | continue; |
| 44 | 45 | } |
| 45 | 46 | |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | if ( is_array( $sub_field ) ) { |
| 60 | 60 | $sub_field = wp_parse_args( $sub_field, $defaults ); |
| 61 | 61 | $sub_field['name'] = $name; |
| 62 | - $this->sub_fields[ $name ] = $sub_field; |
|
| 62 | + $this->sub_fields[$name] = $sub_field; |
|
| 63 | 63 | continue; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | if ( is_string( $sub_field ) ) { |
| 67 | - $this->sub_fields[ $name ] = wp_parse_args( |
|
| 67 | + $this->sub_fields[$name] = wp_parse_args( |
|
| 68 | 68 | array( |
| 69 | 69 | 'name' => $name, |
| 70 | 70 | 'label' => $sub_field, |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if ( is_string( $option ) ) { |
| 119 | - $extra_options[ $key . '_' . $option ] = ''; |
|
| 119 | + $extra_options[$key . '_' . $option] = ''; |
|
| 120 | 120 | } elseif ( ! empty( $option['name'] ) ) { |
| 121 | - $extra_options[ $key . '_' . $option['name'] ] = ''; |
|
| 121 | + $extra_options[$key . '_' . $option['name']] = ''; |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | foreach ( $this->sub_fields as $name => $sub_field ) { |
| 142 | 142 | $sub_field['name'] = $name; |
| 143 | 143 | $wrapper_classes = 'frm_grid_container frm_sub_field_options frm_sub_field_options-' . $sub_field['name']; |
| 144 | - if ( ! isset( $processed_sub_fields[ $name ] ) ) { |
|
| 144 | + if ( ! isset( $processed_sub_fields[$name] ) ) { |
|
| 145 | 145 | // Options for this subfield should be hidden. |
| 146 | 146 | $wrapper_classes .= ' frm_hidden'; |
| 147 | 147 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $default_value = array(); |
| 172 | 172 | |
| 173 | 173 | foreach ( $this->sub_fields as $name => $sub_field ) { |
| 174 | - $default_value[ $name ] = ''; |
|
| 174 | + $default_value[$name] = ''; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | return $default_value; |
@@ -343,8 +343,8 @@ discard block |
||
| 343 | 343 | // Placeholder. |
| 344 | 344 | if ( in_array( 'placeholder', $sub_field['options'], true ) ) { |
| 345 | 345 | $placeholders = FrmField::get_option( $field, 'placeholder' ); |
| 346 | - if ( ! empty( $placeholders[ $sub_field['name'] ] ) ) { |
|
| 347 | - $field['placeholder'] = $placeholders[ $sub_field['name'] ]; |
|
| 346 | + if ( ! empty( $placeholders[$sub_field['name']] ) ) { |
|
| 347 | + $field['placeholder'] = $placeholders[$sub_field['name']]; |
|
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
@@ -401,9 +401,9 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | // Validate not empty. |
| 403 | 403 | foreach ( $sub_fields as $name => $sub_field ) { |
| 404 | - if ( empty( $sub_field['optional'] ) && empty( $args['value'][ $name ] ) ) { |
|
| 405 | - $errors[ 'field' . $args['id'] . '-' . $name ] = ''; |
|
| 406 | - $errors[ 'field' . $args['id'] ] = $blank_msg; |
|
| 404 | + if ( empty( $sub_field['optional'] ) && empty( $args['value'][$name] ) ) { |
|
| 405 | + $errors['field' . $args['id'] . '-' . $name] = ''; |
|
| 406 | + $errors['field' . $args['id']] = $blank_msg; |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | $field_key = isset( $this->field->field_key ) ? $this->field->field_key : $this->field['field_key']; |
| 423 | 423 | $sub_fields = $this->get_processed_sub_fields(); |
| 424 | 424 | foreach ( $sub_fields as $name => $sub_field ) { |
| 425 | - $headings[ $field_id . '_' . $name ] = $field_name . ' (' . $field_key . ') - ' . $sub_field['label']; |
|
| 425 | + $headings[$field_id . '_' . $name] = $field_name . ' (' . $field_key . ') - ' . $sub_field['label']; |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | return $headings; |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | type="text" |
| 52 | 52 | name="<?php echo esc_attr( $input_name ); ?>" |
| 53 | 53 | id="<?php echo esc_attr( $input_id ); ?>" |
| 54 | - value="<?php echo esc_attr( isset( $default_value[ $sub_field['name'] ] ) ? $default_value[ $sub_field['name'] ] : '' ); ?>" |
|
| 54 | + value="<?php echo esc_attr( isset( $default_value[$sub_field['name']] ) ? $default_value[$sub_field['name']] : '' ); ?>" |
|
| 55 | 55 | data-changeme="field_<?php echo esc_attr( $field_key . '_' . $sub_field['name'] ); ?>" |
| 56 | 56 | data-changeatt="value" |
| 57 | 57 | /> |
| 58 | 58 | </span> |
| 59 | 59 | <label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>"> |
| 60 | - <?php echo esc_html( $labels[ $option ] ); ?> |
|
| 60 | + <?php echo esc_html( $labels[$option] ); ?> |
|
| 61 | 61 | </label> |
| 62 | 62 | </p> |
| 63 | 63 | <?php |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | type="text" |
| 75 | 75 | name="<?php echo esc_attr( $input_name ); ?>" |
| 76 | 76 | id="<?php echo esc_attr( $input_id ); ?>" |
| 77 | - value="<?php echo esc_attr( isset( $input_value[ $sub_field['name'] ] ) ? $input_value[ $sub_field['name'] ] : '' ); ?>" |
|
| 77 | + value="<?php echo esc_attr( isset( $input_value[$sub_field['name']] ) ? $input_value[$sub_field['name']] : '' ); ?>" |
|
| 78 | 78 | data-changeme="field_<?php echo esc_attr( $field_key . '_' . $sub_field['name'] ); ?>" |
| 79 | 79 | data-changeatt="<?php echo esc_attr( $option ); ?>" |
| 80 | 80 | /> |
| 81 | 81 | <label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>"> |
| 82 | - <?php echo esc_html( $labels[ $option ] ); ?> |
|
| 82 | + <?php echo esc_html( $labels[$option] ); ?> |
|
| 83 | 83 | </label> |
| 84 | 84 | </p> |
| 85 | 85 | <?php |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | data-changeme="frm_field_<?php echo esc_attr( $field_id . '_' . $sub_field['name'] ); ?>_desc" |
| 101 | 101 | /> |
| 102 | 102 | <label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>"> |
| 103 | - <?php echo esc_html( $labels[ $option ] ); ?> |
|
| 103 | + <?php echo esc_html( $labels[$option] ); ?> |
|
| 104 | 104 | </label> |
| 105 | 105 | </p> |
| 106 | 106 | <?php |
@@ -122,7 +122,8 @@ |
||
| 122 | 122 | |
| 123 | 123 | private static function field_headings( $col ) { |
| 124 | 124 | $field_type_obj = FrmFieldFactory::get_field_factory( $col ); |
| 125 | - if ( ! empty( $field_type_obj->is_combo_field ) ) { // This is combo field. |
|
| 125 | + if ( ! empty( $field_type_obj->is_combo_field ) ) { |
|
| 126 | +// This is combo field. |
|
| 126 | 127 | return $field_type_obj->get_export_headings(); |
| 127 | 128 | } |
| 128 | 129 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | unset( $filename ); |
| 131 | 131 | |
| 132 | - $comment_count = FrmDb::get_count( |
|
| 132 | + $comment_count = FrmDb::get_count( |
|
| 133 | 133 | 'frm_item_metas', |
| 134 | 134 | array( |
| 135 | 135 | 'item_id' => $atts['entry_ids'], |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | private static function prepare_csv_headings() { |
| 225 | 225 | $headings = array(); |
| 226 | 226 | self::csv_headings( $headings ); |
| 227 | - $headings = apply_filters( |
|
| 227 | + $headings = apply_filters( |
|
| 228 | 228 | 'frm_csv_columns', |
| 229 | 229 | $headings, |
| 230 | 230 | self::$form_id, |
@@ -247,10 +247,10 @@ discard block |
||
| 247 | 247 | $field_headings = array(); |
| 248 | 248 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
| 249 | 249 | if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) { |
| 250 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 250 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
| 253 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
| 254 | 254 | $field_headings = apply_filters( |
| 255 | 255 | 'frm_csv_field_columns', |
| 256 | 256 | $field_headings, |
@@ -270,14 +270,14 @@ discard block |
||
| 270 | 270 | foreach ( self::$fields as $col ) { |
| 271 | 271 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 272 | 272 | $repeater_id = $col->field_options['in_section']; |
| 273 | - $headings[ 'repeater' . $repeater_id ] = array(); // set a placeholder to maintain order for repeater fields |
|
| 273 | + $headings['repeater' . $repeater_id] = array(); // set a placeholder to maintain order for repeater fields |
|
| 274 | 274 | |
| 275 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 276 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
| 275 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
| 276 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
| 277 | 277 | $repeater_ids[] = $repeater_id; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
| 280 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
| 281 | 281 | |
| 282 | 282 | continue; |
| 283 | 283 | } |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | $end = strpos( $row->meta_value, ':{' ); |
| 297 | 297 | $length = substr( $row->meta_value, $start, $end - $start ); |
| 298 | 298 | |
| 299 | - if ( $length > $max[ $row->field_id ] ) { |
|
| 300 | - $max[ $row->field_id ] = $length; |
|
| 299 | + if ( $length > $max[$row->field_id] ) { |
|
| 300 | + $max[$row->field_id] = $length; |
|
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -308,17 +308,17 @@ discard block |
||
| 308 | 308 | $repeater_id = str_replace( 'repeater', '', $key ); |
| 309 | 309 | |
| 310 | 310 | $repeater_headings = array(); |
| 311 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
| 311 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
| 312 | 312 | $repeater_headings += self::field_headings( $col ); |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i ++ ) { |
|
| 315 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
| 316 | 316 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
| 317 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
| 317 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | } else { |
| 321 | - $flat[ $key ] = $heading; |
|
| 321 | + $flat[$key] = $heading; |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
@@ -332,9 +332,9 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | if ( self::$comment_count ) { |
| 334 | 334 | for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
| 335 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
| 336 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
| 337 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
| 335 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
| 336 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
| 337 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
| 338 | 338 | } |
| 339 | 339 | unset( $i ); |
| 340 | 340 | } |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | private static function prepare_next_csv_rows( $next_set ) { |
| 381 | 381 | // order by parent_item_id so children will be first |
| 382 | - $where = array( |
|
| 382 | + $where = array( |
|
| 383 | 383 | 'or' => 1, |
| 384 | 384 | 'id' => $next_set, |
| 385 | 385 | 'parent_item_id' => $next_set, |
@@ -425,32 +425,32 @@ discard block |
||
| 425 | 425 | continue; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
| 429 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
| 430 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
| 428 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
| 429 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
| 430 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 434 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
| 435 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 433 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 434 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
| 435 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 436 | 436 | // if the data is here, it should be an array but if this field has collected data |
| 437 | 437 | // both while inside and outside of the repeating section, it's possible this is a string |
| 438 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
| 438 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | //add the repeated values |
| 442 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
| 442 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
| 446 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
| 446 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | // add the embedded form id |
| 450 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
| 451 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
| 450 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
| 451 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
| 452 | 452 | } |
| 453 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
| 453 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | /** |
@@ -471,19 +471,19 @@ discard block |
||
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | $repeater_id = $field->field_options['in_section']; |
| 474 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 474 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
| 475 | 475 | return $metas; |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
| 479 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
| 480 | - $metas[ $repeater_child->id ] = ''; |
|
| 478 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
| 479 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
| 480 | + $metas[$repeater_child->id] = ''; |
|
| 481 | 481 | |
| 482 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) { |
|
| 483 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array(); |
|
| 482 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) { |
|
| 483 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array(); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
| 486 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | |
| 503 | 503 | private static function add_field_values_to_csv( &$row ) { |
| 504 | 504 | foreach ( self::$fields as $col ) { |
| 505 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
| 505 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
| 506 | 506 | |
| 507 | 507 | FrmFieldsHelper::prepare_field_value( $field_value, $col->type ); |
| 508 | 508 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -521,20 +521,20 @@ discard block |
||
| 521 | 521 | if ( ! empty( $col->field_options['separate_value'] ) ) { |
| 522 | 522 | $label_key = $col->id . '_label'; |
| 523 | 523 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 524 | - $row[ $label_key ] = array(); |
|
| 524 | + $row[$label_key] = array(); |
|
| 525 | 525 | |
| 526 | 526 | if ( is_array( $field_value ) ) { |
| 527 | 527 | foreach ( $field_value as $value ) { |
| 528 | - $row[ $label_key ][] = self::get_separate_value_label( $value, $col ); |
|
| 528 | + $row[$label_key][] = self::get_separate_value_label( $value, $col ); |
|
| 529 | 529 | } |
| 530 | 530 | } |
| 531 | 531 | } else { |
| 532 | - $row[ $label_key ] = self::get_separate_value_label( $field_value, $col ); |
|
| 532 | + $row[$label_key] = self::get_separate_value_label( $field_value, $col ); |
|
| 533 | 533 | } |
| 534 | 534 | unset( $label_key ); |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | - $row[ $col->id ] = $field_value; |
|
| 537 | + $row[$col->id] = $field_value; |
|
| 538 | 538 | |
| 539 | 539 | unset( $col, $field_value ); |
| 540 | 540 | } |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | 'show_icon' => false, |
| 558 | 558 | 'entry_id' => self::$entry->id, |
| 559 | 559 | 'sep' => self::$separator, |
| 560 | - 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0, |
|
| 560 | + 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0, |
|
| 561 | 561 | ) |
| 562 | 562 | ); |
| 563 | 563 | } |
@@ -572,8 +572,8 @@ discard block |
||
| 572 | 572 | // This is combo field inside repeater. The heading key has this format: [86_first[0]]. |
| 573 | 573 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
| 574 | 574 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
| 575 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 576 | - $row[ $column_key ] = $sub_sub_value; |
|
| 575 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
| 576 | + $row[$column_key] = $sub_sub_value; |
|
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | 579 | |
@@ -581,8 +581,8 @@ discard block |
||
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | $column_key = $atts['col']->id . '_' . $key; |
| 584 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 585 | - $row[ $column_key ] = $sub_value; |
|
| 584 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
| 585 | + $row[$column_key] = $sub_value; |
|
| 586 | 586 | } |
| 587 | 587 | } |
| 588 | 588 | } |
@@ -607,18 +607,18 @@ discard block |
||
| 607 | 607 | $echo = 'echo' === self::$mode; |
| 608 | 608 | |
| 609 | 609 | foreach ( self::$headings as $k => $heading ) { |
| 610 | - if ( isset( $rows[ $k ] ) ) { |
|
| 611 | - $row = $rows[ $k ]; |
|
| 610 | + if ( isset( $rows[$k] ) ) { |
|
| 611 | + $row = $rows[$k]; |
|
| 612 | 612 | } else { |
| 613 | 613 | $row = ''; |
| 614 | 614 | // array indexed data is not at $rows[ $k ] |
| 615 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
| 615 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
| 616 | 616 | $start = strrpos( $k, '[' ); |
| 617 | 617 | $key = substr( $k, 0, $start ++ ); |
| 618 | 618 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
| 619 | 619 | |
| 620 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
| 621 | - $row = $rows[ $key ][ $index ]; |
|
| 620 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
| 621 | + $row = $rows[$key][$index]; |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | unset( $start, $key, $index ); |