@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | self::print_file_headers( $filename ); |
| 38 | 38 | unset( $filename ); |
| 39 | 39 | |
| 40 | - $comment_count = FrmDb::get_count( |
|
| 40 | + $comment_count = FrmDb::get_count( |
|
| 41 | 41 | 'frm_item_metas', |
| 42 | 42 | array( |
| 43 | 43 | 'item_id' => $atts['entry_ids'], |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | private static function prepare_csv_headings() { |
| 104 | 104 | $headings = array(); |
| 105 | 105 | self::csv_headings( $headings ); |
| 106 | - $headings = apply_filters( |
|
| 106 | + $headings = apply_filters( |
|
| 107 | 107 | 'frm_csv_columns', |
| 108 | 108 | $headings, |
| 109 | 109 | self::$form_id, |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | $field_headings = array(); |
| 121 | 121 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
| 122 | 122 | if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, $separate_values, true ) ) { |
| 123 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 123 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
| 126 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
| 127 | 127 | $field_headings = apply_filters( |
| 128 | 128 | 'frm_csv_field_columns', |
| 129 | 129 | $field_headings, |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | $section = FrmField::getOne( $repeater_id ); |
| 148 | 148 | |
| 149 | 149 | if ( $section && FrmField::is_repeating_field( $section ) ) { |
| 150 | - $headings[ 'repeater' . $repeater_id ] = array(); // set a placeholder to maintain order for repeater fields |
|
| 150 | + $headings['repeater' . $repeater_id] = array(); // set a placeholder to maintain order for repeater fields |
|
| 151 | 151 | |
| 152 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 153 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
| 152 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
| 153 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
| 154 | 154 | $repeater_ids[] = $repeater_id; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
| 157 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -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 | unset( $key, $heading, $max, $repeater_headings, $repeater_id ); |
@@ -203,9 +203,9 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | if ( self::$comment_count ) { |
| 205 | 205 | for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
| 206 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
| 207 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
| 208 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
| 206 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
| 207 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
| 208 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
| 209 | 209 | } |
| 210 | 210 | unset( $i ); |
| 211 | 211 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | private static function prepare_next_csv_rows( $next_set ) { |
| 231 | 231 | // order by parent_item_id so children will be first |
| 232 | - $where = array( |
|
| 232 | + $where = array( |
|
| 233 | 233 | 'or' => 1, |
| 234 | 234 | 'id' => $next_set, |
| 235 | 235 | 'parent_item_id' => $next_set, |
@@ -274,30 +274,30 @@ discard block |
||
| 274 | 274 | continue; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 278 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
| 279 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 277 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 278 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
| 279 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 280 | 280 | // if the data is here, it should be an array but if this field has collected data |
| 281 | 281 | // both while inside and outside of the repeating section, it's possible this is a string |
| 282 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
| 282 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | //add the repeated values |
| 286 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
| 286 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
| 287 | 287 | } |
| 288 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
| 288 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | // add the embedded form id |
| 292 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
| 293 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
| 292 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
| 293 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
| 294 | 294 | } |
| 295 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
| 295 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | private static function add_field_values_to_csv( &$row ) { |
| 299 | 299 | foreach ( self::$fields as $col ) { |
| 300 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
| 300 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
| 301 | 301 | |
| 302 | 302 | FrmAppHelper::unserialize_or_decode( $field_value ); |
| 303 | 303 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -322,15 +322,15 @@ discard block |
||
| 322 | 322 | 'show_icon' => false, |
| 323 | 323 | 'entry_id' => self::$entry->id, |
| 324 | 324 | 'sep' => self::$separator, |
| 325 | - '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, |
|
| 325 | + '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, |
|
| 326 | 326 | ) |
| 327 | 327 | ); |
| 328 | 328 | |
| 329 | - $row[ $col->id . '_label' ] = $sep_value; |
|
| 329 | + $row[$col->id . '_label'] = $sep_value; |
|
| 330 | 330 | unset( $sep_value ); |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - $row[ $col->id ] = $field_value; |
|
| 333 | + $row[$col->id] = $field_value; |
|
| 334 | 334 | |
| 335 | 335 | unset( $col, $field_value ); |
| 336 | 336 | } |
@@ -343,8 +343,8 @@ discard block |
||
| 343 | 343 | if ( is_array( $atts['field_value'] ) ) { |
| 344 | 344 | foreach ( $atts['field_value'] as $key => $sub_value ) { |
| 345 | 345 | $column_key = $atts['col']->id . '_' . $key; |
| 346 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 347 | - $row[ $column_key ] = $sub_value; |
|
| 346 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
| 347 | + $row[$column_key] = $sub_value; |
|
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | } |
@@ -368,18 +368,18 @@ discard block |
||
| 368 | 368 | $sep = ''; |
| 369 | 369 | |
| 370 | 370 | foreach ( self::$headings as $k => $heading ) { |
| 371 | - if ( isset( $rows[ $k ] ) ) { |
|
| 372 | - $row = $rows[ $k ]; |
|
| 371 | + if ( isset( $rows[$k] ) ) { |
|
| 372 | + $row = $rows[$k]; |
|
| 373 | 373 | } else { |
| 374 | 374 | $row = ''; |
| 375 | 375 | // array indexed data is not at $rows[ $k ] |
| 376 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
| 376 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
| 377 | 377 | $start = strrpos( $k, '[' ); |
| 378 | 378 | $key = substr( $k, 0, $start ++ ); |
| 379 | 379 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
| 380 | 380 | |
| 381 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
| 382 | - $row = $rows[ $key ][ $index ]; |
|
| 381 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
| 382 | + $row = $rows[$key][$index]; |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | unset( $start, $key, $index ); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | return; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][ $selected_form ] ) ? $form['xml'][ $selected_form ] : ''; |
|
| 124 | + $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][$selected_form] ) ? $form['xml'][$selected_form] : ''; |
|
| 125 | 125 | if ( empty( $selected_xml ) || strpos( $selected_xml, 'http' ) !== 0 ) { |
| 126 | 126 | return; |
| 127 | 127 | } |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | * @since 4.06.02 |
| 134 | 134 | */ |
| 135 | 135 | private static function get_selected_in_form( $form, $value = 'form' ) { |
| 136 | - if ( ! empty( $form ) && isset( $form[ $value ] ) && ! empty( $form[ $value ] ) ) { |
|
| 137 | - return $form[ $value ]; |
|
| 136 | + if ( ! empty( $form ) && isset( $form[$value] ) && ! empty( $form[$value] ) ) { |
|
| 137 | + return $form[$value]; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | return ''; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | if ( $for === 'view' ) { |
| 166 | - $item_key = is_array( $view_keys ) ? $view_keys[ $form_key ] : $view_keys; |
|
| 166 | + $item_key = is_array( $view_keys ) ? $view_keys[$form_key] : $view_keys; |
|
| 167 | 167 | $shortcode = '[display-frm-data id=%1$s filter=limited]'; |
| 168 | 168 | } elseif ( $for === 'form' ) { |
| 169 | 169 | $item_key = $form_key; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | continue; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - $page_ids[ $for ] = wp_insert_post( |
|
| 181 | + $page_ids[$for] = wp_insert_post( |
|
| 182 | 182 | array( |
| 183 | 183 | 'post_title' => $name, |
| 184 | 184 | 'post_type' => 'page', |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash |
| 320 | 320 | $file_type = sanitize_option( 'upload_path', $_FILES['frm_import_file']['name'] ); |
| 321 | 321 | $file_type = strtolower( pathinfo( $file_type, PATHINFO_EXTENSION ) ); |
| 322 | - if ( 'xml' !== $file_type && isset( $export_format[ $file_type ] ) ) { |
|
| 322 | + if ( 'xml' !== $file_type && isset( $export_format[$file_type] ) ) { |
|
| 323 | 323 | // allow other file types to be imported |
| 324 | 324 | do_action( 'frm_before_import_' . $file_type ); |
| 325 | 325 | |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | foreach ( $type as $tb_type ) { |
| 403 | 403 | $where = array(); |
| 404 | 404 | $join = ''; |
| 405 | - $table = $tables[ $tb_type ]; |
|
| 405 | + $table = $tables[$tb_type]; |
|
| 406 | 406 | |
| 407 | 407 | $select = $table . '.id'; |
| 408 | 408 | $query_vars = array(); |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | $table . '.parent_form_id' => $args['ids'], |
| 418 | 418 | ); |
| 419 | 419 | } else { |
| 420 | - $where[ $table . '.status !' ] = 'draft'; |
|
| 420 | + $where[$table . '.status !'] = 'draft'; |
|
| 421 | 421 | } |
| 422 | 422 | break; |
| 423 | 423 | case 'actions': |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | case 'items': |
| 431 | 431 | // $join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
| 432 | 432 | if ( $args['ids'] ) { |
| 433 | - $where[ $table . '.form_id' ] = $args['ids']; |
|
| 433 | + $where[$table . '.form_id'] = $args['ids']; |
|
| 434 | 434 | } |
| 435 | 435 | break; |
| 436 | 436 | case 'styles': |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 474 | + $records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 475 | 475 | unset( $tb_type ); |
| 476 | 476 | } |
| 477 | 477 | |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | $no_export_fields = FrmField::no_save_fields(); |
| 617 | 617 | foreach ( $csv_fields as $k => $f ) { |
| 618 | 618 | if ( in_array( $f->type, $no_export_fields, true ) ) { |
| 619 | - unset( $csv_fields[ $k ] ); |
|
| 619 | + unset( $csv_fields[$k] ); |
|
| 620 | 620 | } |
| 621 | 621 | } |
| 622 | 622 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | if ( $term && is_array( $term ) ) { |
| 131 | 131 | $imported['imported']['terms'] ++; |
| 132 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
| 132 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | unset( $term, $t ); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | // Keep track of whether this specific form was updated or not. |
| 188 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
| 188 | + $imported['form_status'][$form_id] = 'imported'; |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | // Update field ids/keys to new ones. |
| 201 | 201 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
| 202 | 202 | |
| 203 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
| 203 | + $imported['forms'][(int) $item->id] = $form_id; |
|
| 204 | 204 | |
| 205 | 205 | // Send pre 2.0 form options through function that creates actions. |
| 206 | 206 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -263,15 +263,15 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // Keep track of whether this specific form was updated or not |
| 266 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
| 266 | + $imported['form_status'][$form_id] = 'updated'; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | private static function get_form_fields( $form_id ) { |
| 270 | 270 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
| 271 | 271 | $old_fields = array(); |
| 272 | 272 | foreach ( $form_fields as $f ) { |
| 273 | - $old_fields[ $f->id ] = $f; |
|
| 274 | - $old_fields[ $f->field_key ] = $f->id; |
|
| 273 | + $old_fields[$f->id] = $f; |
|
| 274 | + $old_fields[$f->field_key] = $f->id; |
|
| 275 | 275 | unset( $f ); |
| 276 | 276 | } |
| 277 | 277 | $form_fields = $old_fields; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
| 330 | 330 | if ( $parent_form_id ) { |
| 331 | - $child_forms[ $form_id ] = $parent_form_id; |
|
| 331 | + $child_forms[$form_id] = $parent_form_id; |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
@@ -343,9 +343,9 @@ discard block |
||
| 343 | 343 | */ |
| 344 | 344 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
| 345 | 345 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
| 346 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) { |
|
| 346 | + if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) { |
|
| 347 | 347 | // Update all children with this old parent_form_id |
| 348 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
| 348 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
| 349 | 349 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
| 350 | 350 | do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id ); |
| 351 | 351 | } |
@@ -375,27 +375,27 @@ discard block |
||
| 375 | 375 | |
| 376 | 376 | if ( ! empty( $this_form ) ) { |
| 377 | 377 | // check for field to edit by field id |
| 378 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
| 378 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
| 379 | 379 | FrmField::update( $f['id'], $f ); |
| 380 | 380 | $imported['updated']['fields'] ++; |
| 381 | 381 | |
| 382 | - unset( $form_fields[ $f['id'] ] ); |
|
| 382 | + unset( $form_fields[$f['id']] ); |
|
| 383 | 383 | |
| 384 | 384 | //unset old field key |
| 385 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 386 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 385 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 386 | + unset( $form_fields[$f['field_key']] ); |
|
| 387 | 387 | } |
| 388 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 389 | - $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; |
|
| 388 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 389 | + $keys_by_original_field_id[$f['id']] = $f['field_key']; |
|
| 390 | 390 | |
| 391 | 391 | // check for field to edit by field key |
| 392 | 392 | unset( $f['id'] ); |
| 393 | 393 | |
| 394 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
| 394 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
| 395 | 395 | $imported['updated']['fields'] ++; |
| 396 | 396 | |
| 397 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); //unset old field id |
|
| 398 | - unset( $form_fields[ $f['field_key'] ] ); //unset old field key |
|
| 397 | + unset( $form_fields[$form_fields[$f['field_key']]] ); //unset old field id |
|
| 398 | + unset( $form_fields[$f['field_key']] ); //unset old field key |
|
| 399 | 399 | } else { |
| 400 | 400 | // if no matching field id or key in this form, create the field |
| 401 | 401 | self::create_imported_field( $f, $imported ); |
@@ -504,8 +504,8 @@ discard block |
||
| 504 | 504 | if ( $f['type'] == 'form' || ( $f['type'] == 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
| 505 | 505 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
| 506 | 506 | $form_select = (int) $f['field_options']['form_select']; |
| 507 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
| 508 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
| 507 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
| 508 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | } |
@@ -526,8 +526,8 @@ discard block |
||
| 526 | 526 | |
| 527 | 527 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
| 528 | 528 | $old_form = $f['field_options']['get_values_form']; |
| 529 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
| 530 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
| 529 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
| 530 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
| 531 | 531 | } |
| 532 | 532 | } |
| 533 | 533 | } |
@@ -548,12 +548,12 @@ discard block |
||
| 548 | 548 | private static function migrate_placeholders( &$f ) { |
| 549 | 549 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
| 550 | 550 | foreach ( $update_values as $k => $v ) { |
| 551 | - $f[ $k ] = $v; |
|
| 551 | + $f[$k] = $v; |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
| 555 | 555 | foreach ( $update_values as $k => $v ) { |
| 556 | - $f[ $k ] = $v; |
|
| 556 | + $f[$k] = $v; |
|
| 557 | 557 | } |
| 558 | 558 | } |
| 559 | 559 | |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | public static function migrate_field_placeholder( $field, $type ) { |
| 568 | 568 | $field = (array) $field; |
| 569 | 569 | $field_options = $field['field_options']; |
| 570 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
| 570 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
| 571 | 571 | return array(); |
| 572 | 572 | } |
| 573 | 573 | |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | if ( $opt == $default_value ) { |
| 596 | - unset( $options[ $opt_key ] ); |
|
| 596 | + unset( $options[$opt_key] ); |
|
| 597 | 597 | break; |
| 598 | 598 | } |
| 599 | 599 | } |
@@ -788,17 +788,17 @@ discard block |
||
| 788 | 788 | self::update_postmeta( $post, $post_id ); |
| 789 | 789 | |
| 790 | 790 | $this_type = 'posts'; |
| 791 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
| 792 | - $this_type = $post_types[ $post['post_type'] ]; |
|
| 791 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
| 792 | + $this_type = $post_types[$post['post_type']]; |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
| 796 | - $imported['updated'][ $this_type ] ++; |
|
| 796 | + $imported['updated'][$this_type] ++; |
|
| 797 | 797 | } else { |
| 798 | - $imported['imported'][ $this_type ] ++; |
|
| 798 | + $imported['imported'][$this_type] ++; |
|
| 799 | 799 | } |
| 800 | 800 | |
| 801 | - $imported['posts'][ (int) $old_id ] = $post_id; |
|
| 801 | + $imported['posts'][(int) $old_id] = $post_id; |
|
| 802 | 802 | |
| 803 | 803 | do_action( 'frm_after_import_view', $post_id, $post ); |
| 804 | 804 | |
@@ -815,9 +815,9 @@ discard block |
||
| 815 | 815 | $post['attachment_url'] = (string) $item->attachment_url; |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
| 818 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
| 819 | 819 | // update to new form id |
| 820 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
| 820 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | // Don't allow default styles to take over a site's default style |
@@ -844,8 +844,8 @@ discard block |
||
| 844 | 844 | ); |
| 845 | 845 | |
| 846 | 846 | //switch old form and field ids to new ones |
| 847 | - if ( $m['key'] == 'frm_form_id' && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
| 848 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
| 847 | + if ( $m['key'] == 'frm_form_id' && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
| 848 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
| 849 | 849 | } else { |
| 850 | 850 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 851 | 851 | |
@@ -856,15 +856,15 @@ discard block |
||
| 856 | 856 | } elseif ( $m['key'] == 'frm_options' ) { |
| 857 | 857 | |
| 858 | 858 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
| 859 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
| 860 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
| 859 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
| 860 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
| 861 | 861 | } |
| 862 | 862 | } |
| 863 | 863 | |
| 864 | 864 | $check_dup_array = array(); |
| 865 | 865 | if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) { |
| 866 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
| 867 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
| 866 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
| 867 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
| 868 | 868 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
| 869 | 869 | $check_dup_array[] = 'order_by'; |
| 870 | 870 | } |
@@ -875,9 +875,9 @@ discard block |
||
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | foreach ( $check_dup_array as $check_k ) { |
| 878 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
| 879 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
| 880 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
| 878 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
| 879 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
| 880 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
| 881 | 881 | } |
| 882 | 882 | unset( $mk, $mv ); |
| 883 | 883 | } |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 891 | 891 | } |
| 892 | 892 | |
| 893 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
| 893 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | /** |
@@ -918,11 +918,11 @@ discard block |
||
| 918 | 918 | $name = (string) $c; |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
| 922 | - $post['tax_input'][ $taxonomy ] = array(); |
|
| 921 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
| 922 | + $post['tax_input'][$taxonomy] = array(); |
|
| 923 | 923 | } |
| 924 | 924 | |
| 925 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
| 925 | + $post['tax_input'][$taxonomy][] = $name; |
|
| 926 | 926 | unset( $name ); |
| 927 | 927 | } |
| 928 | 928 | } |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | |
| 1022 | 1022 | $message = '<ul>'; |
| 1023 | 1023 | foreach ( $result as $type => $results ) { |
| 1024 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
| 1024 | + if ( ! isset( $t_strings[$type] ) ) { |
|
| 1025 | 1025 | // only print imported and updated |
| 1026 | 1026 | continue; |
| 1027 | 1027 | } |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | if ( ! empty( $s_message ) ) { |
| 1036 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
| 1036 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
| 1037 | 1037 | $message .= implode( ', ', $s_message ); |
| 1038 | 1038 | $message .= '</li>'; |
| 1039 | 1039 | } |
@@ -1073,7 +1073,7 @@ discard block |
||
| 1073 | 1073 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
| 1074 | 1074 | ); |
| 1075 | 1075 | |
| 1076 | - $s_message[] = isset( $strings[ $type ] ) ? $strings[ $type ] : ' ' . $m . ' ' . ucfirst( $type ); |
|
| 1076 | + $s_message[] = isset( $strings[$type] ) ? $strings[$type] : ' ' . $m . ' ' . ucfirst( $type ); |
|
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | 1079 | /** |
@@ -1205,10 +1205,10 @@ discard block |
||
| 1205 | 1205 | $array_defaults = array_filter( $defaults, 'is_array' ); |
| 1206 | 1206 | foreach ( $array_defaults as $d => $default ) { |
| 1207 | 1207 | // compare array defaults |
| 1208 | - if ( $default == $saved[ $d ] ) { |
|
| 1209 | - unset( $saved[ $d ] ); |
|
| 1208 | + if ( $default == $saved[$d] ) { |
|
| 1209 | + unset( $saved[$d] ); |
|
| 1210 | 1210 | } |
| 1211 | - unset( $defaults[ $d ] ); |
|
| 1211 | + unset( $defaults[$d] ); |
|
| 1212 | 1212 | } |
| 1213 | 1213 | $saved = array_diff_assoc( (array) $saved, $defaults ); |
| 1214 | 1214 | } |
@@ -1219,14 +1219,14 @@ discard block |
||
| 1219 | 1219 | * @since 3.06 |
| 1220 | 1220 | */ |
| 1221 | 1221 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
| 1222 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
| 1222 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
| 1223 | 1223 | return; |
| 1224 | 1224 | } |
| 1225 | 1225 | |
| 1226 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
| 1227 | - $default_html = $defaults[ $html_name ]; |
|
| 1226 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
| 1227 | + $default_html = $defaults[$html_name]; |
|
| 1228 | 1228 | if ( $old_html == $default_html ) { |
| 1229 | - unset( $options[ $html_name ] ); |
|
| 1229 | + unset( $options[$html_name] ); |
|
| 1230 | 1230 | |
| 1231 | 1231 | return; |
| 1232 | 1232 | } |
@@ -1234,7 +1234,7 @@ discard block |
||
| 1234 | 1234 | // Account for some of the older field default HTML. |
| 1235 | 1235 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
| 1236 | 1236 | if ( $old_html == $default_html ) { |
| 1237 | - unset( $options[ $html_name ] ); |
|
| 1237 | + unset( $options[$html_name] ); |
|
| 1238 | 1238 | } |
| 1239 | 1239 | } |
| 1240 | 1240 | |
@@ -1320,8 +1320,8 @@ discard block |
||
| 1320 | 1320 | ); |
| 1321 | 1321 | |
| 1322 | 1322 | foreach ( $post_settings as $post_setting ) { |
| 1323 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
| 1324 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
| 1323 | + if ( isset( $form_options[$post_setting] ) ) { |
|
| 1324 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
| 1325 | 1325 | } |
| 1326 | 1326 | unset( $post_setting ); |
| 1327 | 1327 | } |
@@ -1391,11 +1391,11 @@ discard block |
||
| 1391 | 1391 | foreach ( $post_content as $key => $setting ) { |
| 1392 | 1392 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
| 1393 | 1393 | // Replace old IDs with new IDs |
| 1394 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
| 1394 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
| 1395 | 1395 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
| 1396 | 1396 | foreach ( $setting as $k => $val ) { |
| 1397 | 1397 | // Replace old IDs with new IDs |
| 1398 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
| 1398 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
| 1399 | 1399 | } |
| 1400 | 1400 | } |
| 1401 | 1401 | unset( $key, $setting ); |
@@ -1471,8 +1471,8 @@ discard block |
||
| 1471 | 1471 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
| 1472 | 1472 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
| 1473 | 1473 | foreach ( $delete_settings as $index ) { |
| 1474 | - if ( isset( $form_options[ $index ] ) ) { |
|
| 1475 | - unset( $form_options[ $index ] ); |
|
| 1474 | + if ( isset( $form_options[$index] ) ) { |
|
| 1475 | + unset( $form_options[$index] ); |
|
| 1476 | 1476 | } |
| 1477 | 1477 | } |
| 1478 | 1478 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -1525,12 +1525,12 @@ discard block |
||
| 1525 | 1525 | 'reply_to_name' => '', |
| 1526 | 1526 | ); |
| 1527 | 1527 | foreach ( $reply_fields as $f => $val ) { |
| 1528 | - if ( isset( $notification[ $f ] ) ) { |
|
| 1529 | - $atts[ $f ] = $notification[ $f ]; |
|
| 1530 | - if ( 'custom' == $notification[ $f ] ) { |
|
| 1531 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
| 1532 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
| 1533 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
| 1528 | + if ( isset( $notification[$f] ) ) { |
|
| 1529 | + $atts[$f] = $notification[$f]; |
|
| 1530 | + if ( 'custom' == $notification[$f] ) { |
|
| 1531 | + $atts[$f] = $notification['cust_' . $f]; |
|
| 1532 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
| 1533 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
| 1534 | 1534 | } |
| 1535 | 1535 | } |
| 1536 | 1536 | unset( $f, $val ); |
@@ -1561,13 +1561,13 @@ discard block |
||
| 1561 | 1561 | foreach ( $atts['email_to'] as $key => $email_field ) { |
| 1562 | 1562 | |
| 1563 | 1563 | if ( is_numeric( $email_field ) ) { |
| 1564 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
| 1564 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
| 1565 | 1565 | } |
| 1566 | 1566 | |
| 1567 | 1567 | if ( strpos( $email_field, '|' ) ) { |
| 1568 | 1568 | $email_opt = explode( '|', $email_field ); |
| 1569 | 1569 | if ( isset( $email_opt[0] ) ) { |
| 1570 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 1570 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 1571 | 1571 | } |
| 1572 | 1572 | unset( $email_opt ); |
| 1573 | 1573 | } |
@@ -1588,12 +1588,12 @@ discard block |
||
| 1588 | 1588 | // Add more fields to the new notification |
| 1589 | 1589 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
| 1590 | 1590 | foreach ( $add_fields as $add_field ) { |
| 1591 | - if ( isset( $notification[ $add_field ] ) ) { |
|
| 1592 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
| 1591 | + if ( isset( $notification[$add_field] ) ) { |
|
| 1592 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
| 1593 | 1593 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
| 1594 | - $new_notification['post_content'][ $add_field ] = 0; |
|
| 1594 | + $new_notification['post_content'][$add_field] = 0; |
|
| 1595 | 1595 | } else { |
| 1596 | - $new_notification['post_content'][ $add_field ] = ''; |
|
| 1596 | + $new_notification['post_content'][$add_field] = ''; |
|
| 1597 | 1597 | } |
| 1598 | 1598 | unset( $add_field ); |
| 1599 | 1599 | } |
@@ -1617,7 +1617,7 @@ discard block |
||
| 1617 | 1617 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
| 1618 | 1618 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
| 1619 | 1619 | if ( is_numeric( $email_key ) ) { |
| 1620 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 1620 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 1621 | 1621 | } |
| 1622 | 1622 | unset( $email_key, $val ); |
| 1623 | 1623 | } |