@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | 'description' => esc_html__( 'Just add your email address and you\'ll get 30+ free form templates to your account.', 'formidable' ), |
| 242 | 242 | 'submit_button_text' => esc_html_x( 'Get Templates', 'get free templates modal submit button text', 'formidable' ), |
| 243 | 243 | ); |
| 244 | - $view_parts[] = 'modals/leave-email-modal.php'; |
|
| 244 | + $view_parts[] = 'modals/leave-email-modal.php'; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // Add 'upgrade' modal view for non-elite users. |
@@ -340,12 +340,12 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | // Perform add or remove operation. |
| 342 | 342 | if ( 'add' === $operation ) { |
| 343 | - self::$favorite_templates[ $key ][] = $template_id; |
|
| 343 | + self::$favorite_templates[$key][] = $template_id; |
|
| 344 | 344 | } elseif ( 'remove' === $operation ) { |
| 345 | - $position = array_search( $template_id, self::$favorite_templates[ $key ], true ); |
|
| 345 | + $position = array_search( $template_id, self::$favorite_templates[$key], true ); |
|
| 346 | 346 | |
| 347 | 347 | if ( $position !== false ) { |
| 348 | - unset( self::$favorite_templates[ $key ][ $position ] ); |
|
| 348 | + unset( self::$favorite_templates[$key][$position] ); |
|
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | 351 | |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | foreach ( self::$templates as $key => &$template ) { |
| 504 | 504 | // Skip the template if the categories are not set. |
| 505 | 505 | if ( ! isset( $template['categories'] ) || ! isset( $template['id'] ) ) { |
| 506 | - unset( self::$templates[ $key ] ); |
|
| 506 | + unset( self::$templates[$key] ); |
|
| 507 | 507 | continue; |
| 508 | 508 | } |
| 509 | 509 | |
@@ -517,14 +517,12 @@ discard block |
||
| 517 | 517 | // Add the slug to the new array. |
| 518 | 518 | $template['category_slugs'][] = $category_slug; |
| 519 | 519 | |
| 520 | - if ( ! isset( self::$categories[ $category_slug ] ) ) { |
|
| 521 | - self::$categories[ $category_slug ] = array( |
|
| 520 | + if ( ! isset( self::$categories[$category_slug] ) ) { |
|
| 521 | + self::$categories[$category_slug] = array( |
|
| 522 | 522 | 'name' => $category, |
| 523 | 523 | 'count' => 0, |
| 524 | 524 | ); |
| 525 | - } |
|
| 526 | - |
|
| 527 | - ++self::$categories[ $category_slug ]['count']; |
|
| 525 | + } ++self::$categories[$category_slug]['count']; |
|
| 528 | 526 | } |
| 529 | 527 | |
| 530 | 528 | // Mark the template as favorite if it's in the favorite templates list. |
@@ -540,7 +538,7 @@ discard block |
||
| 540 | 538 | |
| 541 | 539 | foreach ( $redundant_cats as $redundant_cat ) { |
| 542 | 540 | $category_slug = sanitize_title( $redundant_cat ); |
| 543 | - unset( self::$categories[ $category_slug ] ); |
|
| 541 | + unset( self::$categories[$category_slug] ); |
|
| 544 | 542 | } |
| 545 | 543 | |
| 546 | 544 | // Sort the categories by keys alphabetically. |
@@ -589,9 +587,9 @@ discard block |
||
| 589 | 587 | */ |
| 590 | 588 | private static function assign_featured_templates() { |
| 591 | 589 | foreach ( self::FEATURED_TEMPLATES_IDS as $key ) { |
| 592 | - if ( isset( self::$templates[ $key ] ) ) { |
|
| 593 | - self::$templates[ $key ]['is_featured'] = true; |
|
| 594 | - self::$featured_templates[] = self::$templates[ $key ]; |
|
| 590 | + if ( isset( self::$templates[$key] ) ) { |
|
| 591 | + self::$templates[$key]['is_featured'] = true; |
|
| 592 | + self::$featured_templates[] = self::$templates[$key]; |
|
| 595 | 593 | } |
| 596 | 594 | } |
| 597 | 595 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | '<span class="frm-upgrade-submenu">' . esc_html( $cta_text ) . '</span>', |
| 120 | 120 | 'frm_view_forms', |
| 121 | 121 | 'formidable-pro-upgrade', |
| 122 | - function () { |
|
| 122 | + function() { |
|
| 123 | 123 | // This function doesn't need to do anything. |
| 124 | 124 | // The redirect is handled earlier to avoid issues with the headers being sent. |
| 125 | 125 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | unset( $addons['error'] ); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $pro = array( |
|
| 153 | + $pro = array( |
|
| 154 | 154 | 'pro' => array( |
| 155 | 155 | 'title' => 'Formidable Forms Pro', |
| 156 | 156 | 'slug' => 'formidable-pro', |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | // Extract the elements to move |
| 194 | 194 | foreach ( $plans as $plan ) { |
| 195 | - if ( isset( self::$categories[ $plan ] ) ) { |
|
| 196 | - $bottom_categories[ $plan ] = self::$categories[ $plan ]; |
|
| 197 | - unset( self::$categories[ $plan ] ); |
|
| 195 | + if ( isset( self::$categories[$plan] ) ) { |
|
| 196 | + $bottom_categories[$plan] = self::$categories[$plan]; |
|
| 197 | + unset( self::$categories[$plan] ); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
@@ -250,14 +250,12 @@ discard block |
||
| 250 | 250 | // Add the slug to the new array. |
| 251 | 251 | $addon['category-slugs'][] = $category_slug; |
| 252 | 252 | |
| 253 | - if ( ! isset( self::$categories[ $category_slug ] ) ) { |
|
| 254 | - self::$categories[ $category_slug ] = array( |
|
| 253 | + if ( ! isset( self::$categories[$category_slug] ) ) { |
|
| 254 | + self::$categories[$category_slug] = array( |
|
| 255 | 255 | 'name' => $category, |
| 256 | 256 | 'count' => 0, |
| 257 | 257 | ); |
| 258 | - } |
|
| 259 | - |
|
| 260 | - ++self::$categories[ $category_slug ]['count']; |
|
| 258 | + } ++self::$categories[$category_slug]['count']; |
|
| 261 | 259 | } |
| 262 | 260 | } |
| 263 | 261 | |
@@ -290,7 +288,7 @@ discard block |
||
| 290 | 288 | } else { |
| 291 | 289 | foreach ( $addons as $k => $addon ) { |
| 292 | 290 | if ( empty( $addon['excerpt'] ) && $k !== 'error' ) { |
| 293 | - unset( $addons[ $k ] ); |
|
| 291 | + unset( $addons[$k] ); |
|
| 294 | 292 | } |
| 295 | 293 | } |
| 296 | 294 | } |
@@ -405,7 +403,7 @@ discard block |
||
| 405 | 403 | |
| 406 | 404 | foreach ( $list as $k => $info ) { |
| 407 | 405 | $info['slug'] = $k; |
| 408 | - $list[ $k ] = array_merge( $defaults, $info ); |
|
| 406 | + $list[$k] = array_merge( $defaults, $info ); |
|
| 409 | 407 | } |
| 410 | 408 | return $list; |
| 411 | 409 | } |
@@ -575,17 +573,17 @@ discard block |
||
| 575 | 573 | continue; |
| 576 | 574 | } |
| 577 | 575 | |
| 578 | - $wp_plugin = $wp_plugins[ $folder ] ?? array(); |
|
| 576 | + $wp_plugin = $wp_plugins[$folder] ?? array(); |
|
| 579 | 577 | $wp_version = $wp_plugin['Version'] ?? '1.0'; |
| 580 | 578 | $plugin->slug = explode( '/', $folder )[0]; |
| 581 | 579 | |
| 582 | 580 | if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) { |
| 583 | - $transient->response[ $folder ] = $plugin; |
|
| 581 | + $transient->response[$folder] = $plugin; |
|
| 584 | 582 | } else { |
| 585 | - $transient->no_update[ $folder ] = $plugin; |
|
| 583 | + $transient->no_update[$folder] = $plugin; |
|
| 586 | 584 | } |
| 587 | 585 | |
| 588 | - $transient->checked[ $folder ] = $wp_version; |
|
| 586 | + $transient->checked[$folder] = $wp_version; |
|
| 589 | 587 | |
| 590 | 588 | }//end foreach |
| 591 | 589 | |
@@ -619,7 +617,7 @@ discard block |
||
| 619 | 617 | */ |
| 620 | 618 | protected static function is_installed( $plugin ) { |
| 621 | 619 | $all_plugins = self::get_plugins(); |
| 622 | - return isset( $all_plugins[ $plugin ] ); |
|
| 620 | + return isset( $all_plugins[$plugin] ); |
|
| 623 | 621 | } |
| 624 | 622 | |
| 625 | 623 | /** |
@@ -662,14 +660,14 @@ discard block |
||
| 662 | 660 | |
| 663 | 661 | $download_id = $plugin['id'] ?? 0; |
| 664 | 662 | |
| 665 | - if ( ! empty( $download_id ) && ! isset( $version_info[ $download_id ]['package'] ) ) { |
|
| 663 | + if ( ! empty( $download_id ) && ! isset( $version_info[$download_id]['package'] ) ) { |
|
| 666 | 664 | // if this addon is using its own license, get the update url |
| 667 | 665 | $addon_info = $api->get_api_info(); |
| 668 | 666 | |
| 669 | - $version_info[ $download_id ] = $addon_info[ $download_id ]; |
|
| 667 | + $version_info[$download_id] = $addon_info[$download_id]; |
|
| 670 | 668 | |
| 671 | 669 | if ( isset( $addon_info['error'] ) ) { |
| 672 | - $version_info[ $download_id ]['error'] = array( |
|
| 670 | + $version_info[$download_id]['error'] = array( |
|
| 673 | 671 | 'message' => $addon_info['error']['message'], |
| 674 | 672 | 'code' => $addon_info['error']['code'], |
| 675 | 673 | ); |
@@ -777,8 +775,8 @@ discard block |
||
| 777 | 775 | return $addon; |
| 778 | 776 | } |
| 779 | 777 | } |
| 780 | - } elseif ( isset( $addons[ $download_id ] ) ) { |
|
| 781 | - $plugin = $addons[ $download_id ]; |
|
| 778 | + } elseif ( isset( $addons[$download_id] ) ) { |
|
| 779 | + $plugin = $addons[$download_id]; |
|
| 782 | 780 | } |
| 783 | 781 | |
| 784 | 782 | return $plugin; |
@@ -849,7 +847,7 @@ discard block |
||
| 849 | 847 | self::set_addon_status( $addon ); |
| 850 | 848 | self::set_categories( $addon ); |
| 851 | 849 | |
| 852 | - $addons[ $id ] = $addon; |
|
| 850 | + $addons[$id] = $addon; |
|
| 853 | 851 | }//end foreach |
| 854 | 852 | } |
| 855 | 853 | |
@@ -1124,7 +1122,7 @@ discard block |
||
| 1124 | 1122 | */ |
| 1125 | 1123 | public static function ajax_activate_addon() { |
| 1126 | 1124 | self::process_addon_action( |
| 1127 | - function ( $plugin ) { |
|
| 1125 | + function( $plugin ) { |
|
| 1128 | 1126 | return self::handle_addon_action( $plugin, 'activate' ); |
| 1129 | 1127 | }, |
| 1130 | 1128 | array( 'FrmAddonsController', 'get_addon_activation_response' ) |
@@ -1149,7 +1147,7 @@ discard block |
||
| 1149 | 1147 | */ |
| 1150 | 1148 | public static function ajax_deactivate_addon() { |
| 1151 | 1149 | self::process_addon_action( |
| 1152 | - function ( $plugin ) { |
|
| 1150 | + function( $plugin ) { |
|
| 1153 | 1151 | return self::handle_addon_action( $plugin, 'deactivate' ); |
| 1154 | 1152 | } |
| 1155 | 1153 | ); |
@@ -1164,7 +1162,7 @@ discard block |
||
| 1164 | 1162 | */ |
| 1165 | 1163 | public static function ajax_uninstall_addon() { |
| 1166 | 1164 | self::process_addon_action( |
| 1167 | - function ( $plugin ) { |
|
| 1165 | + function( $plugin ) { |
|
| 1168 | 1166 | return self::handle_addon_action( $plugin, 'uninstall' ); |
| 1169 | 1167 | } |
| 1170 | 1168 | ); |
@@ -1571,7 +1569,7 @@ discard block |
||
| 1571 | 1569 | $addons = $api->get_api_info(); |
| 1572 | 1570 | |
| 1573 | 1571 | if ( is_array( $addons ) && array_key_exists( $addon_id, $addons ) ) { |
| 1574 | - $dates = $addons[ $addon_id ]; |
|
| 1572 | + $dates = $addons[$addon_id]; |
|
| 1575 | 1573 | $requires = FrmFormsHelper::get_plan_required( $dates ); |
| 1576 | 1574 | } |
| 1577 | 1575 | |
@@ -118,8 +118,8 @@ |
||
| 118 | 118 | $frm_inc_tax[] = $term->term_id; |
| 119 | 119 | ?> |
| 120 | 120 | <term><term_id><?php echo esc_html( $term->term_id ); ?></term_id><term_taxonomy><?php echo esc_html( $term->taxonomy ); ?></term_taxonomy><?php |
| 121 | - if ( ! empty( $parent_slugs[ $term->parent ] ) ) { |
|
| 122 | - echo '<term_parent>' . esc_html( $parent_slugs[ $term->parent ] ) . '</term_parent>'; |
|
| 121 | + if ( ! empty( $parent_slugs[$term->parent] ) ) { |
|
| 122 | + echo '<term_parent>' . esc_html( $parent_slugs[$term->parent] ) . '</term_parent>'; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if ( ! empty( $term->name ) ) { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $page = $this->get_pagenum(); |
| 33 | 33 | $per_page = $this->get_items_per_page( 'formidable_page_formidable_per_page' ); |
| 34 | 34 | |
| 35 | - $mode = self::get_param( |
|
| 35 | + $mode = self::get_param( |
|
| 36 | 36 | array( |
| 37 | 37 | 'param' => 'mode', |
| 38 | 38 | 'default' => 'list', |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | 'default' => 'name', |
| 45 | 45 | ) |
| 46 | 46 | ); |
| 47 | - $order = self::get_param( |
|
| 47 | + $order = self::get_param( |
|
| 48 | 48 | array( |
| 49 | 49 | 'param' => 'order', |
| 50 | 50 | 'default' => 'ASC', |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $counts = FrmForm::get_count(); |
| 190 | 190 | $form_type = FrmAppHelper::simple_get( 'form_type', 'sanitize_title', 'published' ); |
| 191 | 191 | |
| 192 | - if ( isset( $statuses[ $form_type ] ) ) { |
|
| 192 | + if ( isset( $statuses[$form_type] ) ) { |
|
| 193 | 193 | $counts->$form_type = $this->total_items; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | if ( $counts->{$status} || 'draft' !== $status ) { |
| 208 | 208 | /* translators: %1$s: Status, %2$s: Number of items */ |
| 209 | - $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
| 209 | + $links[$status] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | unset( $status, $name ); |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | $new_actions = FrmFormsHelper::get_action_links( $item->id, $item ); |
| 417 | 417 | |
| 418 | 418 | foreach ( $new_actions as $link => $action ) { |
| 419 | - $new_actions[ $link ] = FrmFormsHelper::format_link_html( $action, 'short' ); |
|
| 419 | + $new_actions[$link] = FrmFormsHelper::format_link_html( $action, 'short' ); |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | if ( 'trash' === $this->status ) { |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | wp_enqueue_script( 'formidable_settings' ); |
| 29 | 29 | return FrmAppHelper::clip( |
| 30 | 30 | // @phpstan-ignore-next-line |
| 31 | - function () use ( $id, $name, $args ) { |
|
| 31 | + function() use ( $id, $name, $args ) { |
|
| 32 | 32 | require FrmAppHelper::plugin_path() . '/classes/views/shared/toggle.php'; |
| 33 | 33 | }, |
| 34 | 34 | $args['echo'] ?? false |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | unset( $filename ); |
| 157 | 157 | |
| 158 | - $comment_count = FrmDb::get_count( |
|
| 158 | + $comment_count = FrmDb::get_count( |
|
| 159 | 159 | 'frm_item_metas', |
| 160 | 160 | array( |
| 161 | 161 | 'item_id' => $atts['entry_ids'], |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | private static function prepare_csv_headings() { |
| 321 | 321 | $headings = array(); |
| 322 | 322 | self::csv_headings( $headings ); |
| 323 | - $headings = apply_filters( |
|
| 323 | + $headings = apply_filters( |
|
| 324 | 324 | 'frm_csv_columns', |
| 325 | 325 | $headings, |
| 326 | 326 | self::$form_id, |
@@ -351,13 +351,13 @@ discard block |
||
| 351 | 351 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
| 352 | 352 | |
| 353 | 353 | if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) { |
| 354 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 354 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - if ( ! empty( $field_headings[ $col->id . '_label' ] ) ) { |
|
| 358 | - $field_headings[ $col->id ] = strip_tags( $col->name . ' ' . __( '(value)', 'formidable' ) ); |
|
| 357 | + if ( ! empty( $field_headings[$col->id . '_label'] ) ) { |
|
| 358 | + $field_headings[$col->id] = strip_tags( $col->name . ' ' . __( '(value)', 'formidable' ) ); |
|
| 359 | 359 | } else { |
| 360 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
| 360 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | return apply_filters( |
@@ -383,14 +383,14 @@ discard block |
||
| 383 | 383 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 384 | 384 | $repeater_id = $col->field_options['in_section']; |
| 385 | 385 | // Set a placeholder to maintain order for repeater fields. |
| 386 | - $headings[ 'repeater' . $repeater_id ] = array(); |
|
| 386 | + $headings['repeater' . $repeater_id] = array(); |
|
| 387 | 387 | |
| 388 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 389 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
| 388 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
| 389 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
| 390 | 390 | $repeater_ids[] = $repeater_id; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
| 393 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
| 394 | 394 | |
| 395 | 395 | continue; |
| 396 | 396 | } |
@@ -409,8 +409,8 @@ discard block |
||
| 409 | 409 | $end = strpos( $row->meta_value, ':{' ); |
| 410 | 410 | $length = substr( $row->meta_value, $start, $end - $start ); |
| 411 | 411 | |
| 412 | - if ( $length > $max[ $row->field_id ] ) { |
|
| 413 | - $max[ $row->field_id ] = $length; |
|
| 412 | + if ( $length > $max[$row->field_id] ) { |
|
| 413 | + $max[$row->field_id] = $length; |
|
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -423,17 +423,17 @@ discard block |
||
| 423 | 423 | |
| 424 | 424 | $repeater_headings = array(); |
| 425 | 425 | |
| 426 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
| 426 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
| 427 | 427 | $repeater_headings += self::field_headings( $col ); |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i++ ) { |
|
| 430 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
| 431 | 431 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
| 432 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
| 432 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
| 433 | 433 | } |
| 434 | 434 | } |
| 435 | 435 | } else { |
| 436 | - $flat[ $key ] = $heading; |
|
| 436 | + $flat[$key] = $heading; |
|
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | |
@@ -446,10 +446,10 @@ discard block |
||
| 446 | 446 | }//end if |
| 447 | 447 | |
| 448 | 448 | if ( self::$comment_count ) { |
| 449 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
| 450 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
| 451 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
| 452 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
| 449 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
| 450 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
| 451 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
| 452 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
| 453 | 453 | } |
| 454 | 454 | unset( $i ); |
| 455 | 455 | } |
@@ -569,32 +569,32 @@ discard block |
||
| 569 | 569 | continue; |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
| 573 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
| 574 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
| 572 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
| 573 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
| 574 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 578 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
| 579 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 577 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 578 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
| 579 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 580 | 580 | // if the data is here, it should be an array but if this field has collected data |
| 581 | 581 | // both while inside and outside of the repeating section, it's possible this is a string. |
| 582 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
| 582 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | // Add the repeated values. |
| 586 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
| 586 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
| 587 | 587 | }//end foreach |
| 588 | 588 | |
| 589 | 589 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
| 590 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
| 590 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
| 591 | 591 | }//end if |
| 592 | 592 | |
| 593 | 593 | // add the embedded form id |
| 594 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
| 595 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
| 594 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
| 595 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
| 596 | 596 | } |
| 597 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
| 597 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | /** |
@@ -617,19 +617,19 @@ discard block |
||
| 617 | 617 | |
| 618 | 618 | $repeater_id = $field->field_options['in_section']; |
| 619 | 619 | |
| 620 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 620 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
| 621 | 621 | return $metas; |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
| 625 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
| 626 | - $metas[ $repeater_child->id ] = ''; |
|
| 624 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
| 625 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
| 626 | + $metas[$repeater_child->id] = ''; |
|
| 627 | 627 | |
| 628 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) { |
|
| 629 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array(); |
|
| 628 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) { |
|
| 629 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array(); |
|
| 630 | 630 | } |
| 631 | 631 | |
| 632 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
| 632 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
| 633 | 633 | } |
| 634 | 634 | } |
| 635 | 635 | |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | */ |
| 660 | 660 | private static function add_field_values_to_csv( &$row ) { |
| 661 | 661 | foreach ( self::$fields as $col ) { |
| 662 | - $field_value = self::$entry->metas[ $col->id ] ?? false; |
|
| 662 | + $field_value = self::$entry->metas[$col->id] ?? false; |
|
| 663 | 663 | |
| 664 | 664 | FrmFieldsHelper::prepare_field_value( $field_value, $col->type ); |
| 665 | 665 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -679,20 +679,20 @@ discard block |
||
| 679 | 679 | $label_key = $col->id . '_label'; |
| 680 | 680 | |
| 681 | 681 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 682 | - $row[ $label_key ] = array(); |
|
| 682 | + $row[$label_key] = array(); |
|
| 683 | 683 | |
| 684 | 684 | if ( is_array( $field_value ) ) { |
| 685 | 685 | foreach ( $field_value as $value ) { |
| 686 | - $row[ $label_key ][] = self::get_separate_value_label( $value, $col ); |
|
| 686 | + $row[$label_key][] = self::get_separate_value_label( $value, $col ); |
|
| 687 | 687 | } |
| 688 | 688 | } |
| 689 | 689 | } else { |
| 690 | - $row[ $label_key ] = self::get_separate_value_label( $field_value, $col ); |
|
| 690 | + $row[$label_key] = self::get_separate_value_label( $field_value, $col ); |
|
| 691 | 691 | } |
| 692 | 692 | unset( $label_key ); |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | - $row[ $col->id ] = $field_value; |
|
| 695 | + $row[$col->id] = $field_value; |
|
| 696 | 696 | |
| 697 | 697 | unset( $col, $field_value ); |
| 698 | 698 | }//end foreach |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | 'show_icon' => false, |
| 717 | 717 | 'entry_id' => self::$entry->id, |
| 718 | 718 | 'sep' => self::$separator, |
| 719 | - '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, |
|
| 719 | + '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, |
|
| 720 | 720 | ) |
| 721 | 721 | ); |
| 722 | 722 | } |
@@ -737,8 +737,8 @@ discard block |
||
| 737 | 737 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
| 738 | 738 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
| 739 | 739 | |
| 740 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 741 | - $row[ $column_key ] = $sub_sub_value; |
|
| 740 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
| 741 | + $row[$column_key] = $sub_sub_value; |
|
| 742 | 742 | } |
| 743 | 743 | } |
| 744 | 744 | |
@@ -747,8 +747,8 @@ discard block |
||
| 747 | 747 | |
| 748 | 748 | $column_key = $atts['col']->id . '_' . $key; |
| 749 | 749 | |
| 750 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 751 | - $row[ $column_key ] = $sub_value; |
|
| 750 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
| 751 | + $row[$column_key] = $sub_value; |
|
| 752 | 752 | } |
| 753 | 753 | } |
| 754 | 754 | }//end if |
@@ -784,19 +784,19 @@ discard block |
||
| 784 | 784 | $echo = 'echo' === self::$mode; |
| 785 | 785 | |
| 786 | 786 | foreach ( self::$headings as $k => $heading ) { |
| 787 | - if ( isset( $rows[ $k ] ) ) { |
|
| 788 | - $row = $rows[ $k ]; |
|
| 787 | + if ( isset( $rows[$k] ) ) { |
|
| 788 | + $row = $rows[$k]; |
|
| 789 | 789 | } else { |
| 790 | 790 | $row = ''; |
| 791 | 791 | |
| 792 | 792 | // array indexed data is not at $rows[ $k ] |
| 793 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
| 793 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
| 794 | 794 | $start = strrpos( $k, '[' ); |
| 795 | - $key = substr( $k, 0, $start++ ); |
|
| 795 | + $key = substr( $k, 0, $start ++ ); |
|
| 796 | 796 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
| 797 | 797 | |
| 798 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
| 799 | - $row = $rows[ $key ][ $index ]; |
|
| 798 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
| 799 | + $row = $rows[$key][$index]; |
|
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | unset( $start, $key, $index ); |
@@ -504,8 +504,8 @@ discard block |
||
| 504 | 504 | return $values; |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - if ( is_array( $previous_entry->metas ) && isset( $previous_entry->metas[ $field->id ] ) ) { |
|
| 508 | - $values['value'] = $previous_entry->metas[ $field->id ]; |
|
| 507 | + if ( is_array( $previous_entry->metas ) && isset( $previous_entry->metas[$field->id] ) ) { |
|
| 508 | + $values['value'] = $previous_entry->metas[$field->id]; |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | $frm_vars['trans_filled'] = true; |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | * |
| 543 | 543 | * @return void |
| 544 | 544 | */ |
| 545 | - function () use ( $entry_id, &$destroy_callback ) { |
|
| 545 | + function() use ( $entry_id, &$destroy_callback ) { |
|
| 546 | 546 | FrmEntry::destroy( $entry_id ); |
| 547 | 547 | // Only call this once. |
| 548 | 548 | remove_action( 'frm_entry_form', $destroy_callback ); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $is_stripe = $gateway === 'stripe' || ( is_array( $gateway ) && in_array( 'stripe', $gateway, true ) ); |
| 79 | 79 | |
| 80 | 80 | if ( ! $is_stripe || empty( $payment_action->post_content['amount'] ) ) { |
| 81 | - unset( $payment_actions[ $k ] ); |
|
| 81 | + unset( $payment_actions[$k] ); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | return $payment_actions; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | 'run_triggers' => false, |
| 118 | 118 | 'show_errors' => true, |
| 119 | 119 | ); |
| 120 | - $atts = compact( 'action', 'entry', 'form' ); |
|
| 120 | + $atts = compact( 'action', 'entry', 'form' ); |
|
| 121 | 121 | |
| 122 | 122 | $amount = self::prepare_amount( $action->post_content['amount'], $atts ); |
| 123 | 123 | |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | |
| 522 | 522 | foreach ( $settings as $k => $s ) { |
| 523 | 523 | if ( is_string( $s ) ) { |
| 524 | - $settings[ $k ] = str_replace( $disallowed, '', $s ); |
|
| 524 | + $settings[$k] = str_replace( $disallowed, '', $s ); |
|
| 525 | 525 | } |
| 526 | 526 | } |
| 527 | 527 | |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | * @return array |
| 651 | 651 | */ |
| 652 | 652 | public static function remove_cc_validation( $errors, $field, $values ) { |
| 653 | - $has_processed = isset( $_POST[ 'frmintent' . $field->form_id ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 653 | + $has_processed = isset( $_POST['frmintent' . $field->form_id] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 654 | 654 | |
| 655 | 655 | if ( ! $has_processed ) { |
| 656 | 656 | return $errors; |
@@ -658,12 +658,12 @@ discard block |
||
| 658 | 658 | |
| 659 | 659 | $field_id = $field->temp_id ?? $field->id; |
| 660 | 660 | |
| 661 | - if ( isset( $errors[ 'field' . $field_id . '-cc' ] ) ) { |
|
| 662 | - unset( $errors[ 'field' . $field_id . '-cc' ] ); |
|
| 661 | + if ( isset( $errors['field' . $field_id . '-cc'] ) ) { |
|
| 662 | + unset( $errors['field' . $field_id . '-cc'] ); |
|
| 663 | 663 | } |
| 664 | 664 | |
| 665 | - if ( isset( $errors[ 'field' . $field_id ] ) ) { |
|
| 666 | - unset( $errors[ 'field' . $field_id ] ); |
|
| 665 | + if ( isset( $errors['field' . $field_id] ) ) { |
|
| 666 | + unset( $errors['field' . $field_id] ); |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | return $errors; |