@@ -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 ); |
@@ -5,15 +5,15 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | class FrmFormAction { |
| 7 | 7 | |
| 8 | - public $id_base; // Root id for all actions of this type. |
|
| 9 | - public $name; // Name for this action type. |
|
| 8 | + public $id_base; // Root id for all actions of this type. |
|
| 9 | + public $name; // Name for this action type. |
|
| 10 | 10 | public $option_name; |
| 11 | - public $action_options; // Option array passed to wp_register_sidebar_widget() |
|
| 11 | + public $action_options; // Option array passed to wp_register_sidebar_widget() |
|
| 12 | 12 | public $control_options; // Option array passed to wp_register_widget_control() |
| 13 | 13 | |
| 14 | - public $form_id; // The ID of the form to evaluate |
|
| 15 | - public $number = false; // Unique ID number of the current instance. |
|
| 16 | - public $id = ''; // Unique ID string of the current instance (id_base-number) |
|
| 14 | + public $form_id; // The ID of the form to evaluate |
|
| 15 | + public $number = false; // Unique ID number of the current instance. |
|
| 16 | + public $id = ''; // Unique ID string of the current instance (id_base-number) |
|
| 17 | 17 | public $updated = false; // Set true when we update the data after a POST submit - makes sure we don't do it twice. |
| 18 | 18 | |
| 19 | 19 | // Member functions that you must over-ride. |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | $groups = FrmFormActionsController::form_action_groups(); |
| 142 | 142 | $group = 'misc'; |
| 143 | 143 | |
| 144 | - if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) { |
|
| 144 | + if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) { |
|
| 145 | 145 | $group = $action_options['group']; |
| 146 | - } elseif ( isset( $groups[ $this->id_base ] ) ) { |
|
| 146 | + } elseif ( isset( $groups[$this->id_base] ) ) { |
|
| 147 | 147 | $group = $this->id_base; |
| 148 | 148 | } else { |
| 149 | 149 | foreach ( $groups as $name => $check_group ) { |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - $groups[ $group ]['id'] = $group; |
|
| 158 | - return $groups[ $group ]; |
|
| 157 | + $groups[$group]['id'] = $group; |
|
| 158 | + return $groups[$group]; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @return integer $post_id |
| 258 | 258 | */ |
| 259 | 259 | public function maybe_create_action( $action, $forms ) { |
| 260 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
|
| 260 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) { |
|
| 261 | 261 | // Update action only |
| 262 | 262 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
| 263 | 263 | $post_id = $this->save_settings( $action ); |
@@ -277,18 +277,18 @@ discard block |
||
| 277 | 277 | $switch = $this->get_global_switch_fields(); |
| 278 | 278 | |
| 279 | 279 | foreach ( (array) $action->post_content as $key => $val ) { |
| 280 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
| 281 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
| 280 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
| 281 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
| 282 | 282 | } elseif ( ! is_array( $val ) ) { |
| 283 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 284 | - } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
| 283 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 284 | + } elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
| 285 | 285 | // loop through each value if empty |
| 286 | - if ( empty( $switch[ $key ] ) ) { |
|
| 287 | - $switch[ $key ] = array_keys( $val ); |
|
| 286 | + if ( empty( $switch[$key] ) ) { |
|
| 287 | + $switch[$key] = array_keys( $val ); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - foreach ( $switch[ $key ] as $subkey ) { |
|
| 291 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
| 290 | + foreach ( $switch[$key] as $subkey ) { |
|
| 291 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | |
@@ -306,20 +306,20 @@ discard block |
||
| 306 | 306 | foreach ( $subkey as $subkey2 ) { |
| 307 | 307 | foreach ( (array) $val as $ck => $cv ) { |
| 308 | 308 | if ( is_array( $cv ) ) { |
| 309 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
| 310 | - } elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
| 311 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
| 309 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
| 310 | + } elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
| 311 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | } else { |
| 316 | 316 | foreach ( (array) $val as $ck => $cv ) { |
| 317 | 317 | if ( is_array( $cv ) ) { |
| 318 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
| 319 | - } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
| 320 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
| 318 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
| 319 | + } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
| 320 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
| 321 | 321 | } elseif ( $ck == $subkey ) { |
| 322 | - $action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] ); |
|
| 322 | + $action[$ck] = $this->maybe_switch_field_ids( $action[$ck] ); |
|
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | } |
@@ -342,10 +342,10 @@ discard block |
||
| 342 | 342 | return; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
| 345 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
| 346 | 346 | // Sanitizing removes scripts and <email> type of values. |
| 347 | 347 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 348 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
| 348 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
| 349 | 349 | } else { |
| 350 | 350 | return; |
| 351 | 351 | } |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | foreach ( $settings as $number => $new_instance ) { |
| 356 | 356 | $this->_set( $number ); |
| 357 | 357 | |
| 358 | - $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
|
| 358 | + $old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array(); |
|
| 359 | 359 | |
| 360 | 360 | if ( ! isset( $new_instance['post_status'] ) ) { |
| 361 | 361 | $new_instance['post_status'] = 'draft'; |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $new_instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
| 396 | 396 | |
| 397 | 397 | if ( false !== $instance ) { |
| 398 | - $all_instances[ $number ] = $instance; |
|
| 398 | + $all_instances[$number] = $instance; |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | $action_ids[] = $this->save_settings( $instance ); |
@@ -471,12 +471,12 @@ discard block |
||
| 471 | 471 | // some plugins/themes are formatting the post_excerpt |
| 472 | 472 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
| 473 | 473 | |
| 474 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
| 474 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
| 475 | 475 | continue; |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
| 479 | - $settings[ $action->ID ] = $action; |
|
| 478 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
| 479 | + $settings[$action->ID] = $action; |
|
| 480 | 480 | |
| 481 | 481 | if ( count( $settings ) >= $limit ) { |
| 482 | 482 | break; |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | 'limit' => 99, |
| 507 | 507 | 'post_status' => $default_status, |
| 508 | 508 | ); |
| 509 | - $args = wp_parse_args( $args, $defaults ); |
|
| 509 | + $args = wp_parse_args( $args, $defaults ); |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | /** |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | |
| 568 | 568 | $action = $this->prepare_action( $action ); |
| 569 | 569 | |
| 570 | - $settings[ $action->ID ] = $action; |
|
| 570 | + $settings[$action->ID] = $action; |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | if ( 1 === $limit ) { |
@@ -604,10 +604,10 @@ discard block |
||
| 604 | 604 | |
| 605 | 605 | foreach ( $default_values as $k => $vals ) { |
| 606 | 606 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
| 607 | - if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
| 607 | + if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
| 608 | 608 | continue; |
| 609 | 609 | } |
| 610 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
| 610 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | |
@@ -682,14 +682,14 @@ discard block |
||
| 682 | 682 | * Migrate settings from form->options into new action. |
| 683 | 683 | */ |
| 684 | 684 | public function migrate_to_2( $form, $update = 'update' ) { |
| 685 | - $action = $this->prepare_new( $form->id ); |
|
| 685 | + $action = $this->prepare_new( $form->id ); |
|
| 686 | 686 | FrmAppHelper::unserialize_or_decode( $form->options ); |
| 687 | 687 | |
| 688 | 688 | // fill with existing options |
| 689 | 689 | foreach ( $action->post_content as $name => $val ) { |
| 690 | - if ( isset( $form->options[ $name ] ) ) { |
|
| 691 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
| 692 | - unset( $form->options[ $name ] ); |
|
| 690 | + if ( isset( $form->options[$name] ) ) { |
|
| 691 | + $action->post_content[$name] = $form->options[$name]; |
|
| 692 | + unset( $form->options[$name] ); |
|
| 693 | 693 | } |
| 694 | 694 | } |
| 695 | 695 | |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | $stop = $stop ? false : true; |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | - $met[ $stop ] = $stop; |
|
| 758 | + $met[$stop] = $stop; |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) { |
@@ -806,8 +806,8 @@ discard block |
||
| 806 | 806 | private static function get_value_from_entry( $entry, $field_id ) { |
| 807 | 807 | $observed_value = ''; |
| 808 | 808 | |
| 809 | - if ( isset( $entry->metas[ $field_id ] ) ) { |
|
| 810 | - $observed_value = $entry->metas[ $field_id ]; |
|
| 809 | + if ( isset( $entry->metas[$field_id] ) ) { |
|
| 810 | + $observed_value = $entry->metas[$field_id]; |
|
| 811 | 811 | } elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) { |
| 812 | 812 | $field = FrmField::getOne( $field_id ); |
| 813 | 813 | $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value( |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | self::print_file_headers( $filename ); |
| 42 | 42 | unset( $filename ); |
| 43 | 43 | |
| 44 | - $comment_count = FrmDb::get_count( |
|
| 44 | + $comment_count = FrmDb::get_count( |
|
| 45 | 45 | 'frm_item_metas', |
| 46 | 46 | array( |
| 47 | 47 | 'item_id' => $atts['entry_ids'], |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | private static function prepare_csv_headings() { |
| 108 | 108 | $headings = array(); |
| 109 | 109 | self::csv_headings( $headings ); |
| 110 | - $headings = apply_filters( |
|
| 110 | + $headings = apply_filters( |
|
| 111 | 111 | 'frm_csv_columns', |
| 112 | 112 | $headings, |
| 113 | 113 | self::$form_id, |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | $field_headings = array(); |
| 125 | 125 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
| 126 | 126 | if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, $separate_values, true ) ) { |
| 127 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 127 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
| 130 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
| 131 | 131 | $field_headings = apply_filters( |
| 132 | 132 | 'frm_csv_field_columns', |
| 133 | 133 | $field_headings, |
@@ -146,14 +146,14 @@ discard block |
||
| 146 | 146 | foreach ( self::$fields as $col ) { |
| 147 | 147 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 148 | 148 | $repeater_id = $col->field_options['in_section']; |
| 149 | - $headings[ 'repeater' . $repeater_id ] = array(); // set a placeholder to maintain order for repeater fields |
|
| 149 | + $headings['repeater' . $repeater_id] = array(); // set a placeholder to maintain order for repeater fields |
|
| 150 | 150 | |
| 151 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 152 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
| 151 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
| 152 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
| 153 | 153 | $repeater_ids[] = $repeater_id; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
| 156 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
| 157 | 157 | } else { |
| 158 | 158 | $headings += self::field_headings( $col ); |
| 159 | 159 | } |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | $end = strpos( $row->meta_value, ':{' ); |
| 171 | 171 | $length = substr( $row->meta_value, $start, $end - $start ); |
| 172 | 172 | |
| 173 | - if ( $length > $max[ $row->field_id ] ) { |
|
| 174 | - $max[ $row->field_id ] = $length; |
|
| 173 | + if ( $length > $max[$row->field_id] ) { |
|
| 174 | + $max[$row->field_id] = $length; |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -182,17 +182,17 @@ discard block |
||
| 182 | 182 | $repeater_id = str_replace( 'repeater', '', $key ); |
| 183 | 183 | |
| 184 | 184 | $repeater_headings = array(); |
| 185 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
| 185 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
| 186 | 186 | $repeater_headings += self::field_headings( $col ); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i ++ ) { |
|
| 189 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
| 190 | 190 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
| 191 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
| 191 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | } else { |
| 195 | - $flat[ $key ] = $heading; |
|
| 195 | + $flat[$key] = $heading; |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | if ( self::$comment_count ) { |
| 208 | 208 | for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
| 209 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
| 210 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
| 211 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
| 209 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
| 210 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
| 211 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
| 212 | 212 | } |
| 213 | 213 | unset( $i ); |
| 214 | 214 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | private static function prepare_next_csv_rows( $next_set ) { |
| 253 | 253 | // order by parent_item_id so children will be first |
| 254 | - $where = array( |
|
| 254 | + $where = array( |
|
| 255 | 255 | 'or' => 1, |
| 256 | 256 | 'id' => $next_set, |
| 257 | 257 | 'parent_item_id' => $next_set, |
@@ -296,32 +296,32 @@ discard block |
||
| 296 | 296 | continue; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
| 300 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
| 301 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
| 299 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
| 300 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
| 301 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 305 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
| 306 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 304 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 305 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
| 306 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 307 | 307 | // if the data is here, it should be an array but if this field has collected data |
| 308 | 308 | // both while inside and outside of the repeating section, it's possible this is a string |
| 309 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
| 309 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | //add the repeated values |
| 313 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
| 313 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
| 317 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
| 317 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | // add the embedded form id |
| 321 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
| 322 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
| 321 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
| 322 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
| 323 | 323 | } |
| 324 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
| 324 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
@@ -342,14 +342,14 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | $repeater_id = $field->field_options['in_section']; |
| 345 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 345 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
| 346 | 346 | return $metas; |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
| 350 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
| 351 | - $metas[ $repeater_child->id ] = ''; |
|
| 352 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
| 349 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
| 350 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
| 351 | + $metas[$repeater_child->id] = ''; |
|
| 352 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | private static function add_field_values_to_csv( &$row ) { |
| 370 | 370 | foreach ( self::$fields as $col ) { |
| 371 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
| 371 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
| 372 | 372 | |
| 373 | 373 | FrmAppHelper::unserialize_or_decode( $field_value ); |
| 374 | 374 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -393,15 +393,15 @@ discard block |
||
| 393 | 393 | 'show_icon' => false, |
| 394 | 394 | 'entry_id' => self::$entry->id, |
| 395 | 395 | 'sep' => self::$separator, |
| 396 | - '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, |
|
| 396 | + '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, |
|
| 397 | 397 | ) |
| 398 | 398 | ); |
| 399 | 399 | |
| 400 | - $row[ $col->id . '_label' ] = $sep_value; |
|
| 400 | + $row[$col->id . '_label'] = $sep_value; |
|
| 401 | 401 | unset( $sep_value ); |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - $row[ $col->id ] = $field_value; |
|
| 404 | + $row[$col->id] = $field_value; |
|
| 405 | 405 | |
| 406 | 406 | unset( $col, $field_value ); |
| 407 | 407 | } |
@@ -414,8 +414,8 @@ discard block |
||
| 414 | 414 | if ( is_array( $atts['field_value'] ) ) { |
| 415 | 415 | foreach ( $atts['field_value'] as $key => $sub_value ) { |
| 416 | 416 | $column_key = $atts['col']->id . '_' . $key; |
| 417 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 418 | - $row[ $column_key ] = $sub_value; |
|
| 417 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
| 418 | + $row[$column_key] = $sub_value; |
|
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | } |
@@ -439,18 +439,18 @@ discard block |
||
| 439 | 439 | $sep = ''; |
| 440 | 440 | |
| 441 | 441 | foreach ( self::$headings as $k => $heading ) { |
| 442 | - if ( isset( $rows[ $k ] ) ) { |
|
| 443 | - $row = $rows[ $k ]; |
|
| 442 | + if ( isset( $rows[$k] ) ) { |
|
| 443 | + $row = $rows[$k]; |
|
| 444 | 444 | } else { |
| 445 | 445 | $row = ''; |
| 446 | 446 | // array indexed data is not at $rows[ $k ] |
| 447 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
| 447 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
| 448 | 448 | $start = strrpos( $k, '[' ); |
| 449 | 449 | $key = substr( $k, 0, $start ++ ); |
| 450 | 450 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
| 451 | 451 | |
| 452 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
| 453 | - $row = $rows[ $key ][ $index ]; |
|
| 452 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
| 453 | + $row = $rows[$key][$index]; |
|
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | unset( $start, $key, $index ); |
@@ -125,7 +125,8 @@ |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // Only do this for single site installs. |
| 128 | - if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { // WPCS: CSRF ok. |
|
| 128 | + if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { |
|
| 129 | +// WPCS: CSRF ok. |
|
| 129 | 130 | return; |
| 130 | 131 | } |
| 131 | 132 | |