@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | $cross_sell_links = $data['cross_sell_link']; |
| 113 | 113 | $index = self::determine_cross_sell_index( $cross_sell_text ); |
| 114 | 114 | |
| 115 | - self::$cross_sell_text = sanitize_text_field( $cross_sell_text[ $index ] ); |
|
| 116 | - self::$cross_sell_link = esc_url_raw( $cross_sell_links[ $index ] ); |
|
| 115 | + self::$cross_sell_text = sanitize_text_field( $cross_sell_text[$index] ); |
|
| 116 | + self::$cross_sell_link = esc_url_raw( $cross_sell_links[$index] ); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | foreach ( $cross_sell_text as $index => $current_text ) { |
| 161 | - if ( ! isset( $cross_sell_settings[ $current_text ] ) ) { |
|
| 162 | - $cross_sell_settings[ $current_text ] = time(); |
|
| 161 | + if ( ! isset( $cross_sell_settings[$current_text] ) ) { |
|
| 162 | + $cross_sell_settings[$current_text] = time(); |
|
| 163 | 163 | update_option( $option_name, $cross_sell_settings ); |
| 164 | 164 | return $index; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - $time_elapsed = time() - $cross_sell_settings[ $current_text ]; |
|
| 167 | + $time_elapsed = time() - $cross_sell_settings[$current_text]; |
|
| 168 | 168 | if ( $time_elapsed < DAY_IN_SECONDS * 30 ) { |
| 169 | 169 | return $index; |
| 170 | 170 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | return; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - self::$sales[ $sale['key'] ] = $this->fill_sale( $sale ); |
|
| 200 | + self::$sales[$sale['key']] = $this->fill_sale( $sale ); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | $sale = self::$instance->get_best_sale(); |
| 306 | 306 | |
| 307 | - return is_array( $sale ) && ! empty( $sale[ $key ] ) ? $sale[ $key ] : false; |
|
| 307 | + return is_array( $sale ) && ! empty( $sale[$key] ) ? $sale[$key] : false; |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /** |
@@ -501,14 +501,14 @@ discard block |
||
| 501 | 501 | esc_html( self::$cross_sell_text ), |
| 502 | 502 | 'activate_plugins', |
| 503 | 503 | 'frm-sales-api-cross-sell', |
| 504 | - function () { |
|
| 504 | + function() { |
|
| 505 | 505 | // There is no page. The redirect logic is handled below, before this callback is triggered. |
| 506 | 506 | } |
| 507 | 507 | ); |
| 508 | 508 | |
| 509 | 509 | add_action( |
| 510 | 510 | 'admin_init', |
| 511 | - function () { |
|
| 511 | + function() { |
|
| 512 | 512 | if ( ! current_user_can( 'activate_plugins' ) ) { |
| 513 | 513 | return; |
| 514 | 514 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | '<span class="frm-upgrade-submenu">' . esc_html( $cta_text ) . '</span>', |
| 117 | 117 | 'frm_view_forms', |
| 118 | 118 | 'formidable-pro-upgrade', |
| 119 | - function () { |
|
| 119 | + function() { |
|
| 120 | 120 | // This function doesn't need to do anything. |
| 121 | 121 | // The redirect is handled earlier to avoid issues with the headers being sent. |
| 122 | 122 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | unset( $addons['error'] ); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - $pro = array( |
|
| 150 | + $pro = array( |
|
| 151 | 151 | 'pro' => array( |
| 152 | 152 | 'title' => 'Formidable Forms Pro', |
| 153 | 153 | 'slug' => 'formidable-pro', |
@@ -189,9 +189,9 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | // Extract the elements to move |
| 191 | 191 | foreach ( $plans as $plan ) { |
| 192 | - if ( isset( self::$categories[ $plan ] ) ) { |
|
| 193 | - $bottom_categories[ $plan ] = self::$categories[ $plan ]; |
|
| 194 | - unset( self::$categories[ $plan ] ); |
|
| 192 | + if ( isset( self::$categories[$plan] ) ) { |
|
| 193 | + $bottom_categories[$plan] = self::$categories[$plan]; |
|
| 194 | + unset( self::$categories[$plan] ); |
|
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | |
@@ -245,14 +245,12 @@ discard block |
||
| 245 | 245 | // Add the slug to the new array. |
| 246 | 246 | $addon['category-slugs'][] = $category_slug; |
| 247 | 247 | |
| 248 | - if ( ! isset( self::$categories[ $category_slug ] ) ) { |
|
| 249 | - self::$categories[ $category_slug ] = array( |
|
| 248 | + if ( ! isset( self::$categories[$category_slug] ) ) { |
|
| 249 | + self::$categories[$category_slug] = array( |
|
| 250 | 250 | 'name' => $category, |
| 251 | 251 | 'count' => 0, |
| 252 | 252 | ); |
| 253 | - } |
|
| 254 | - |
|
| 255 | - ++self::$categories[ $category_slug ]['count']; |
|
| 253 | + } ++self::$categories[$category_slug]['count']; |
|
| 256 | 254 | } |
| 257 | 255 | } |
| 258 | 256 | |
@@ -284,7 +282,7 @@ discard block |
||
| 284 | 282 | } else { |
| 285 | 283 | foreach ( $addons as $k => $addon ) { |
| 286 | 284 | if ( empty( $addon['excerpt'] ) && $k !== 'error' ) { |
| 287 | - unset( $addons[ $k ] ); |
|
| 285 | + unset( $addons[$k] ); |
|
| 288 | 286 | } |
| 289 | 287 | } |
| 290 | 288 | } |
@@ -398,7 +396,7 @@ discard block |
||
| 398 | 396 | |
| 399 | 397 | foreach ( $list as $k => $info ) { |
| 400 | 398 | $info['slug'] = $k; |
| 401 | - $list[ $k ] = array_merge( $defaults, $info ); |
|
| 399 | + $list[$k] = array_merge( $defaults, $info ); |
|
| 402 | 400 | } |
| 403 | 401 | return $list; |
| 404 | 402 | } |
@@ -549,17 +547,17 @@ discard block |
||
| 549 | 547 | continue; |
| 550 | 548 | } |
| 551 | 549 | |
| 552 | - $wp_plugin = $wp_plugins[ $folder ] ?? array(); |
|
| 550 | + $wp_plugin = $wp_plugins[$folder] ?? array(); |
|
| 553 | 551 | $wp_version = $wp_plugin['Version'] ?? '1.0'; |
| 554 | 552 | $plugin->slug = explode( '/', $folder )[0]; |
| 555 | 553 | |
| 556 | 554 | if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) { |
| 557 | - $transient->response[ $folder ] = $plugin; |
|
| 555 | + $transient->response[$folder] = $plugin; |
|
| 558 | 556 | } else { |
| 559 | - $transient->no_update[ $folder ] = $plugin; |
|
| 557 | + $transient->no_update[$folder] = $plugin; |
|
| 560 | 558 | } |
| 561 | 559 | |
| 562 | - $transient->checked[ $folder ] = $wp_version; |
|
| 560 | + $transient->checked[$folder] = $wp_version; |
|
| 563 | 561 | |
| 564 | 562 | }//end foreach |
| 565 | 563 | |
@@ -592,7 +590,7 @@ discard block |
||
| 592 | 590 | */ |
| 593 | 591 | protected static function is_installed( $plugin ) { |
| 594 | 592 | $all_plugins = self::get_plugins(); |
| 595 | - return isset( $all_plugins[ $plugin ] ); |
|
| 593 | + return isset( $all_plugins[$plugin] ); |
|
| 596 | 594 | } |
| 597 | 595 | |
| 598 | 596 | /** |
@@ -631,13 +629,13 @@ discard block |
||
| 631 | 629 | } |
| 632 | 630 | |
| 633 | 631 | $download_id = $plugin['id'] ?? 0; |
| 634 | - if ( ! empty( $download_id ) && ! isset( $version_info[ $download_id ]['package'] ) ) { |
|
| 632 | + if ( ! empty( $download_id ) && ! isset( $version_info[$download_id]['package'] ) ) { |
|
| 635 | 633 | // if this addon is using its own license, get the update url |
| 636 | 634 | $addon_info = $api->get_api_info(); |
| 637 | 635 | |
| 638 | - $version_info[ $download_id ] = $addon_info[ $download_id ]; |
|
| 636 | + $version_info[$download_id] = $addon_info[$download_id]; |
|
| 639 | 637 | if ( isset( $addon_info['error'] ) ) { |
| 640 | - $version_info[ $download_id ]['error'] = array( |
|
| 638 | + $version_info[$download_id]['error'] = array( |
|
| 641 | 639 | 'message' => $addon_info['error']['message'], |
| 642 | 640 | 'code' => $addon_info['error']['code'], |
| 643 | 641 | ); |
@@ -736,8 +734,8 @@ discard block |
||
| 736 | 734 | return $addon; |
| 737 | 735 | } |
| 738 | 736 | } |
| 739 | - } elseif ( isset( $addons[ $download_id ] ) ) { |
|
| 740 | - $plugin = $addons[ $download_id ]; |
|
| 737 | + } elseif ( isset( $addons[$download_id] ) ) { |
|
| 738 | + $plugin = $addons[$download_id]; |
|
| 741 | 739 | } |
| 742 | 740 | |
| 743 | 741 | return $plugin; |
@@ -803,7 +801,7 @@ discard block |
||
| 803 | 801 | self::set_addon_status( $addon ); |
| 804 | 802 | self::set_categories( $addon ); |
| 805 | 803 | |
| 806 | - $addons[ $id ] = $addon; |
|
| 804 | + $addons[$id] = $addon; |
|
| 807 | 805 | }//end foreach |
| 808 | 806 | } |
| 809 | 807 | |
@@ -838,7 +836,7 @@ discard block |
||
| 838 | 836 | if ( strpos( $link, 'http' ) !== 0 ) { |
| 839 | 837 | $link = $site_url . $link; |
| 840 | 838 | } |
| 841 | - $link = FrmAppHelper::make_affiliate_url( $link ); |
|
| 839 | + $link = FrmAppHelper::make_affiliate_url( $link ); |
|
| 842 | 840 | |
| 843 | 841 | $utm = array( |
| 844 | 842 | 'campaign' => 'addons', |
@@ -1061,7 +1059,7 @@ discard block |
||
| 1061 | 1059 | */ |
| 1062 | 1060 | public static function ajax_activate_addon() { |
| 1063 | 1061 | self::process_addon_action( |
| 1064 | - function ( $plugin ) { |
|
| 1062 | + function( $plugin ) { |
|
| 1065 | 1063 | return self::handle_addon_action( $plugin, 'activate' ); |
| 1066 | 1064 | }, |
| 1067 | 1065 | array( 'FrmAddonsController', 'get_addon_activation_response' ) |
@@ -1086,7 +1084,7 @@ discard block |
||
| 1086 | 1084 | */ |
| 1087 | 1085 | public static function ajax_deactivate_addon() { |
| 1088 | 1086 | self::process_addon_action( |
| 1089 | - function ( $plugin ) { |
|
| 1087 | + function( $plugin ) { |
|
| 1090 | 1088 | return self::handle_addon_action( $plugin, 'deactivate' ); |
| 1091 | 1089 | } |
| 1092 | 1090 | ); |
@@ -1101,7 +1099,7 @@ discard block |
||
| 1101 | 1099 | */ |
| 1102 | 1100 | public static function ajax_uninstall_addon() { |
| 1103 | 1101 | self::process_addon_action( |
| 1104 | - function ( $plugin ) { |
|
| 1102 | + function( $plugin ) { |
|
| 1105 | 1103 | return self::handle_addon_action( $plugin, 'uninstall' ); |
| 1106 | 1104 | } |
| 1107 | 1105 | ); |
@@ -1499,7 +1497,7 @@ discard block |
||
| 1499 | 1497 | $addons = $api->get_api_info(); |
| 1500 | 1498 | |
| 1501 | 1499 | if ( is_array( $addons ) && array_key_exists( $addon_id, $addons ) ) { |
| 1502 | - $dates = $addons[ $addon_id ]; |
|
| 1500 | + $dates = $addons[$addon_id]; |
|
| 1503 | 1501 | $requires = FrmFormsHelper::get_plan_required( $dates ); |
| 1504 | 1502 | } |
| 1505 | 1503 | |
@@ -1334,11 +1334,11 @@ discard block |
||
| 1334 | 1334 | wp_set_script_translations( 's11-floating-links-config', 's11-' ); |
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | - $upgrade_utm = array( |
|
| 1337 | + $upgrade_utm = array( |
|
| 1338 | 1338 | 'campaign' => 'floating-links', |
| 1339 | 1339 | 'content' => 'floating-links-upgrade', |
| 1340 | 1340 | ); |
| 1341 | - $docs_utm = array( |
|
| 1341 | + $docs_utm = array( |
|
| 1342 | 1342 | 'campaign' => 'floating-links', |
| 1343 | 1343 | 'content' => 'floating-links-docs', |
| 1344 | 1344 | ); |
@@ -1412,15 +1412,15 @@ discard block |
||
| 1412 | 1412 | global $wp_filter; |
| 1413 | 1413 | |
| 1414 | 1414 | foreach ( $actions as $action ) { |
| 1415 | - if ( empty( $wp_filter[ $action ]->callbacks ) ) { |
|
| 1415 | + if ( empty( $wp_filter[$action]->callbacks ) ) { |
|
| 1416 | 1416 | continue; |
| 1417 | 1417 | } |
| 1418 | - foreach ( $wp_filter[ $action ]->callbacks as $priority => $callbacks ) { |
|
| 1418 | + foreach ( $wp_filter[$action]->callbacks as $priority => $callbacks ) { |
|
| 1419 | 1419 | foreach ( $callbacks as $callback_name => $callback ) { |
| 1420 | 1420 | if ( self::is_our_callback_string( $callback_name ) || self::is_our_callback_array( $callback ) ) { |
| 1421 | 1421 | continue; |
| 1422 | 1422 | } |
| 1423 | - unset( $wp_filter[ $action ]->callbacks[ $priority ][ $callback_name ] ); |
|
| 1423 | + unset( $wp_filter[$action]->callbacks[$priority][$callback_name] ); |
|
| 1424 | 1424 | } |
| 1425 | 1425 | } |
| 1426 | 1426 | } |
@@ -1458,8 +1458,8 @@ discard block |
||
| 1458 | 1458 | $current_sort = $previous_meta; |
| 1459 | 1459 | $form_id = $is_entry_list ? FrmAppHelper::simple_get( 'form', 'absint' ) : 0; |
| 1460 | 1460 | |
| 1461 | - if ( is_array( $current_sort ) && $form_id && is_int( $form_id ) && isset( $current_sort[ $form_id ] ) ) { |
|
| 1462 | - $current_sort = $current_sort[ $form_id ]; |
|
| 1461 | + if ( is_array( $current_sort ) && $form_id && is_int( $form_id ) && isset( $current_sort[$form_id] ) ) { |
|
| 1462 | + $current_sort = $current_sort[$form_id]; |
|
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | 1465 | if ( $new_sort !== $current_sort ) { |
@@ -1468,7 +1468,7 @@ discard block |
||
| 1468 | 1468 | if ( $is_entry_list && $form_id && is_int( $form_id ) ) { |
| 1469 | 1469 | // Index meta by form ID. |
| 1470 | 1470 | $temp_meta = is_array( $previous_meta ) ? $previous_meta : array(); |
| 1471 | - $temp_meta[ $form_id ] = $new_meta; |
|
| 1471 | + $temp_meta[$form_id] = $new_meta; |
|
| 1472 | 1472 | $new_meta = $temp_meta; |
| 1473 | 1473 | unset( $temp_meta ); |
| 1474 | 1474 | } |
@@ -1496,8 +1496,8 @@ discard block |
||
| 1496 | 1496 | $preferred_list_sort = get_user_meta( $user_id, $meta_key, true ); |
| 1497 | 1497 | $form_id = FrmAppHelper::simple_get( 'form', 'absint' ); |
| 1498 | 1498 | |
| 1499 | - if ( is_array( $preferred_list_sort ) && $form_id && is_int( $form_id ) && isset( $preferred_list_sort[ $form_id ] ) ) { |
|
| 1500 | - $preferred_list_sort = $preferred_list_sort[ $form_id ]; |
|
| 1499 | + if ( is_array( $preferred_list_sort ) && $form_id && is_int( $form_id ) && isset( $preferred_list_sort[$form_id] ) ) { |
|
| 1500 | + $preferred_list_sort = $preferred_list_sort[$form_id]; |
|
| 1501 | 1501 | } |
| 1502 | 1502 | |
| 1503 | 1503 | if ( is_array( $preferred_list_sort ) && ! empty( $preferred_list_sort['orderby'] ) ) { |
@@ -14,7 +14,10 @@ |
||
| 14 | 14 | ); |
| 15 | 15 | ?> |
| 16 | 16 | Please <a href="<?php echo esc_url( FrmAppHelper::admin_upgrade_link( $utm, 'account/downloads/' ) ); ?>">renew now</a> to get the latest version. |
| 17 | - <?php else : ?> |
|
| 18 | - Please <a href="<?php echo esc_url( admin_url( 'plugins.php?s=formidable%20forms%20pro' ) ); ?>">update now</a>. |
|
| 17 | + <?php else { |
|
| 18 | + : ?> |
|
| 19 | + Please <a href="<?php echo esc_url( admin_url( 'plugins.php?s=formidable%20forms%20pro' ) ); |
|
| 20 | +} |
|
| 21 | +?>">update now</a>. |
|
| 19 | 22 | <?php endif; ?> |
| 20 | 23 | </div> |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $active_step = 0; |
| 119 | 119 | |
| 120 | 120 | foreach ( $step_keys as $index => $step_key ) { |
| 121 | - $completed_step = isset( self::$checklist['completed_steps'][ $step_key ] ); |
|
| 121 | + $completed_step = isset( self::$checklist['completed_steps'][$step_key] ); |
|
| 122 | 122 | |
| 123 | 123 | if ( false === $completed_step ) { |
| 124 | 124 | switch ( $step_key ) { |
@@ -132,15 +132,15 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if ( $completed_step ) { |
| 135 | - self::$checklist['completed_steps'][ $step_key ] = true; |
|
| 135 | + self::$checklist['completed_steps'][$step_key] = true; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | // Count completed steps from start until gap found. |
| 139 | 139 | if ( $completed_step && $index === $active_step ) { |
| 140 | - $active_step++; |
|
| 140 | + $active_step ++; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - self::$steps['steps'][ $index ]['completed'] = $completed_step; |
|
| 143 | + self::$steps['steps'][$index]['completed'] = $completed_step; |
|
| 144 | 144 | }//end foreach |
| 145 | 145 | |
| 146 | 146 | self::$checklist['active_step'] = $active_step; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | self::$checklist['done'] = true; |
| 150 | 150 | self::$checklist['active_step_key'] = 'completed'; |
| 151 | 151 | } else { |
| 152 | - self::$checklist['active_step_key'] = $step_keys[ $active_step ]; |
|
| 152 | + self::$checklist['active_step_key'] = $step_keys[$active_step]; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | self::save_checklist(); |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | private static function fill_step_completed_data( $steps, $steps_keys ) { |
| 201 | 201 | return array_map( |
| 202 | - function ( $step, $step_key ) { |
|
| 203 | - $step['completed'] = isset( self::$checklist['completed_steps'][ $step_key ] ); |
|
| 202 | + function( $step, $step_key ) { |
|
| 203 | + $step['completed'] = isset( self::$checklist['completed_steps'][$step_key] ); |
|
| 204 | 204 | return $step; |
| 205 | 205 | }, |
| 206 | 206 | $steps, |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | 'target' => '#frm_style_sidebar .frm-style-card > div', |
| 235 | 235 | 'left-position' => 'end', |
| 236 | 236 | 'offset' => array( |
| 237 | - 'top' => -22, |
|
| 237 | + 'top' => - 22, |
|
| 238 | 238 | 'left' => 16, |
| 239 | 239 | ), |
| 240 | 240 | ); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | break; |
| 251 | 251 | }//end switch |
| 252 | 252 | |
| 253 | - return array_merge( self::$steps['steps'][ self::$checklist['active_step'] ], $spotlight_data ); |
|
| 253 | + return array_merge( self::$steps['steps'][self::$checklist['active_step']], $spotlight_data ); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | self::$checklist = self::get_checklist(); |
| 380 | - self::$checklist['completed_steps'][ $step_key ] = true; |
|
| 380 | + self::$checklist['completed_steps'][$step_key] = true; |
|
| 381 | 381 | self::save_checklist(); |
| 382 | 382 | |
| 383 | 383 | wp_send_json_success(); |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | $steps = self::get_steps(); |
| 592 | 592 | |
| 593 | 593 | foreach ( $steps as $key => $step ) { |
| 594 | - $usage_data[ 'completed_step_' . $key ] = empty( $option['completed_steps'][ $key ] ) ? 0 : 1; |
|
| 594 | + $usage_data['completed_step_' . $key] = empty( $option['completed_steps'][$key] ) ? 0 : 1; |
|
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | $usage_data['done'] = empty( $option['done'] ) ? 0 : 1; |
@@ -267,11 +267,11 @@ discard block |
||
| 267 | 267 | 'ranking' => '2024-03-12', |
| 268 | 268 | ); |
| 269 | 269 | |
| 270 | - if ( ! isset( $release_dates[ $type ] ) ) { |
|
| 270 | + if ( ! isset( $release_dates[$type] ) ) { |
|
| 271 | 271 | return false; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - $release_date = $release_dates[ $type ]; |
|
| 274 | + $release_date = $release_dates[$type]; |
|
| 275 | 275 | |
| 276 | 276 | $three_months_after_release = gmdate( 'Y-m-d', strtotime( $release_date . ' + 90 days' ) ); |
| 277 | 277 | return gmdate( 'Y-m-d' ) < $three_months_after_release; |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
| 305 | 305 | |
| 306 | 306 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 307 | - if ( isset( $values[ $col ] ) ) { |
|
| 308 | - $new_values[ $col ] = $values[ $col ]; |
|
| 307 | + if ( isset( $values[$col] ) ) { |
|
| 308 | + $new_values[$col] = $values[$col]; |
|
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 318 | 318 | |
| 319 | 319 | if ( isset( $values['id'] ) ) { |
| 320 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 320 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 321 | 321 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 322 | 322 | } |
| 323 | 323 | |
@@ -326,9 +326,9 @@ discard block |
||
| 326 | 326 | foreach ( $new_values as $k => $v ) { |
| 327 | 327 | if ( is_array( $v ) ) { |
| 328 | 328 | if ( $k === 'default_value' ) { |
| 329 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 329 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 330 | 330 | } else { |
| 331 | - $new_values[ $k ] = serialize( $v ); |
|
| 331 | + $new_values[$k] = serialize( $v ); |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | unset( $k, $v ); |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | if ( isset( $values['id'] ) ) { |
| 351 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 351 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | return $new_id; |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | * @param array $match Shortcode data. |
| 400 | 400 | * @return string |
| 401 | 401 | */ |
| 402 | - function ( $match ) { |
|
| 402 | + function( $match ) { |
|
| 403 | 403 | $attr = shortcode_parse_atts( $match[3] ); |
| 404 | 404 | |
| 405 | 405 | if ( ! is_array( $attr ) ) { |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | if ( FrmAppHelper::input_key_is_safe( $key, 'update' ) ) { |
| 427 | - $safe_atts[ $key ] = $value; |
|
| 427 | + $safe_atts[$key] = $value; |
|
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | 430 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
| 483 | 483 | global $frm_duplicate_ids; |
| 484 | 484 | |
| 485 | - $where = array( |
|
| 485 | + $where = array( |
|
| 486 | 486 | array( |
| 487 | 487 | 'or' => 1, |
| 488 | 488 | 'fi.form_id' => $old_form_id, |
@@ -528,8 +528,8 @@ discard block |
||
| 528 | 528 | |
| 529 | 529 | $values = apply_filters( 'frm_duplicated_field', $values ); |
| 530 | 530 | $new_id = self::create( $values ); |
| 531 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 532 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 531 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 532 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 533 | 533 | unset( $field ); |
| 534 | 534 | }//end foreach |
| 535 | 535 | } |
@@ -578,11 +578,11 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | // serialize array values |
| 580 | 580 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 581 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 581 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 582 | 582 | if ( 'field_options' === $opt ) { |
| 583 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
| 583 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
| 584 | 584 | } |
| 585 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 585 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 586 | 586 | } |
| 587 | 587 | } |
| 588 | 588 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -769,8 +769,8 @@ discard block |
||
| 769 | 769 | continue; |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | - $fields[ $result->id ] = $result; |
|
| 773 | - ++$count; |
|
| 772 | + $fields[$result->id] = $result; |
|
| 773 | + ++ $count; |
|
| 774 | 774 | if ( $limit == 1 ) { |
| 775 | 775 | $fields = $result; |
| 776 | 776 | break; |
@@ -821,8 +821,8 @@ discard block |
||
| 821 | 821 | $fields = array(); |
| 822 | 822 | $count = 0; |
| 823 | 823 | foreach ( $results as $result ) { |
| 824 | - ++$count; |
|
| 825 | - $fields[ $result->id ] = $result; |
|
| 824 | + ++ $count; |
|
| 825 | + $fields[$result->id] = $result; |
|
| 826 | 826 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 827 | 827 | break; |
| 828 | 828 | } |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | $query_type = $limit === ' LIMIT 1' || $limit == 1 ? 'row' : 'results'; |
| 937 | 937 | |
| 938 | 938 | if ( is_array( $where ) ) { |
| 939 | - $args = array( |
|
| 939 | + $args = array( |
|
| 940 | 940 | 'order_by' => $order_by, |
| 941 | 941 | 'limit' => $limit, |
| 942 | 942 | ); |
@@ -969,9 +969,9 @@ discard block |
||
| 969 | 969 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 970 | 970 | |
| 971 | 971 | self::prepare_options( $result ); |
| 972 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 973 | - $results[ $r_key ]->options = $result->options; |
|
| 974 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 972 | + $results[$r_key]->field_options = $result->field_options; |
|
| 973 | + $results[$r_key]->options = $result->options; |
|
| 974 | + $results[$r_key]->default_value = $result->default_value; |
|
| 975 | 975 | |
| 976 | 976 | unset( $r_key, $result ); |
| 977 | 977 | } |
@@ -1050,7 +1050,7 @@ discard block |
||
| 1050 | 1050 | |
| 1051 | 1051 | if ( count( $next_fields ) >= self::$transient_size ) { |
| 1052 | 1052 | // if this transient is full, check for another |
| 1053 | - ++$next; |
|
| 1053 | + ++ $next; |
|
| 1054 | 1054 | self::get_next_transient( $fields, $base_name, $next ); |
| 1055 | 1055 | } |
| 1056 | 1056 | } |
@@ -1078,7 +1078,7 @@ discard block |
||
| 1078 | 1078 | return; |
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | - ++$next; |
|
| 1081 | + ++ $next; |
|
| 1082 | 1082 | } |
| 1083 | 1083 | } |
| 1084 | 1084 | |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | * @return bool |
| 1227 | 1227 | */ |
| 1228 | 1228 | public static function is_option_true_in_array( $field, $option ) { |
| 1229 | - return ! empty( $field[ $option ] ); |
|
| 1229 | + return ! empty( $field[$option] ); |
|
| 1230 | 1230 | } |
| 1231 | 1231 | |
| 1232 | 1232 | /** |
@@ -1235,7 +1235,7 @@ discard block |
||
| 1235 | 1235 | * @return bool |
| 1236 | 1236 | */ |
| 1237 | 1237 | public static function is_option_true_in_object( $field, $option ) { |
| 1238 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 1238 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | 1241 | /** |
@@ -1244,7 +1244,7 @@ discard block |
||
| 1244 | 1244 | * @return bool |
| 1245 | 1245 | */ |
| 1246 | 1246 | public static function is_option_empty_in_array( $field, $option ) { |
| 1247 | - return empty( $field[ $option ] ); |
|
| 1247 | + return empty( $field[$option] ); |
|
| 1248 | 1248 | } |
| 1249 | 1249 | |
| 1250 | 1250 | /** |
@@ -1253,7 +1253,7 @@ discard block |
||
| 1253 | 1253 | * @return bool |
| 1254 | 1254 | */ |
| 1255 | 1255 | public static function is_option_empty_in_object( $field, $option ) { |
| 1256 | - return empty( $field->field_options[ $option ] ); |
|
| 1256 | + return empty( $field->field_options[$option] ); |
|
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | 1259 | /** |
@@ -1262,7 +1262,7 @@ discard block |
||
| 1262 | 1262 | * @return bool |
| 1263 | 1263 | */ |
| 1264 | 1264 | public static function is_option_value_in_object( $field, $option ) { |
| 1265 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 1265 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 1266 | 1266 | } |
| 1267 | 1267 | |
| 1268 | 1268 | /** |
@@ -1288,10 +1288,10 @@ discard block |
||
| 1288 | 1288 | * @return mixed |
| 1289 | 1289 | */ |
| 1290 | 1290 | public static function get_option_in_array( $field, $option ) { |
| 1291 | - if ( isset( $field[ $option ] ) ) { |
|
| 1292 | - $this_option = $field[ $option ]; |
|
| 1293 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
| 1294 | - $this_option = $field['field_options'][ $option ]; |
|
| 1291 | + if ( isset( $field[$option] ) ) { |
|
| 1292 | + $this_option = $field[$option]; |
|
| 1293 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
| 1294 | + $this_option = $field['field_options'][$option]; |
|
| 1295 | 1295 | } else { |
| 1296 | 1296 | $this_option = ''; |
| 1297 | 1297 | } |
@@ -1305,7 +1305,7 @@ discard block |
||
| 1305 | 1305 | * @return mixed |
| 1306 | 1306 | */ |
| 1307 | 1307 | public static function get_option_in_object( $field, $option ) { |
| 1308 | - return $field->field_options[ $option ] ?? ''; |
|
| 1308 | + return $field->field_options[$option] ?? ''; |
|
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | 1311 | /** |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | global $wpdb; |
| 60 | 60 | |
| 61 | - $values = array( |
|
| 61 | + $values = array( |
|
| 62 | 62 | 'item_id' => $entry_id, |
| 63 | 63 | 'field_id' => $field_id, |
| 64 | 64 | ); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $values_indexed_by_field_id[ $field_id ] = $meta_value; |
|
| 141 | + $values_indexed_by_field_id[$field_id] = $meta_value; |
|
| 142 | 142 | |
| 143 | 143 | self::get_value_to_save( compact( 'field', 'field_id', 'entry_id' ), $meta_value ); |
| 144 | 144 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | if ( ( is_array( $meta_value ) && empty( $meta_value ) ) || ( ! is_array( $meta_value ) && trim( $meta_value ) === '' ) ) { |
| 148 | 148 | // Remove blank fields. |
| 149 | - unset( $values_indexed_by_field_id[ $field_id ] ); |
|
| 149 | + unset( $values_indexed_by_field_id[$field_id] ); |
|
| 150 | 150 | } else { |
| 151 | 151 | // if value exists, then update it |
| 152 | 152 | self::update_entry_meta( $entry_id, $field_id, '', $meta_value ); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | public static function get_meta_value( $entry, $field_id ) { |
| 226 | 226 | if ( isset( $entry->metas ) ) { |
| 227 | - return $entry->metas[ $field_id ] ?? false; |
|
| 227 | + return $entry->metas[$field_id] ?? false; |
|
| 228 | 228 | } |
| 229 | 229 | return self::get_entry_meta_by_field( $entry->id, $field_id ); |
| 230 | 230 | } |
@@ -246,8 +246,8 @@ discard block |
||
| 246 | 246 | $cached = FrmDb::check_cache( $entry_id, 'frm_entry' ); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) { |
|
| 250 | - $result = $cached->metas[ $field_id ]; |
|
| 249 | + if ( $cached && isset( $cached->metas ) && isset( $cached->metas[$field_id] ) ) { |
|
| 250 | + $result = $cached->metas[$field_id]; |
|
| 251 | 251 | |
| 252 | 252 | return wp_unslash( $result ); |
| 253 | 253 | } |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | 'stripslashes' => true, |
| 281 | 281 | 'is_draft' => false, |
| 282 | 282 | ); |
| 283 | - $args = wp_parse_args( $args, $defaults ); |
|
| 283 | + $args = wp_parse_args( $args, $defaults ); |
|
| 284 | 284 | |
| 285 | 285 | $query = array(); |
| 286 | 286 | self::meta_field_query( $field_id, $order, $limit, $args, $query ); |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | foreach ( $values as $k => $v ) { |
| 297 | 297 | FrmAppHelper::unserialize_or_decode( $v ); |
| 298 | - $values[ $k ] = $v; |
|
| 298 | + $values[$k] = $v; |
|
| 299 | 299 | unset( $k, $v ); |
| 300 | 300 | } |
| 301 | 301 | |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | |
| 363 | 363 | foreach ( $results as $k => $result ) { |
| 364 | 364 | FrmAppHelper::unserialize_or_decode( $result->meta_value ); |
| 365 | - $results[ $k ]->meta_value = wp_unslash( $result->meta_value ); |
|
| 365 | + $results[$k]->meta_value = wp_unslash( $result->meta_value ); |
|
| 366 | 366 | unset( $k, $result ); |
| 367 | 367 | } |
| 368 | 368 | |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | 'user_id' => '', |
| 376 | 376 | 'group_by' => '', |
| 377 | 377 | ); |
| 378 | - $args = wp_parse_args( $args, $defaults ); |
|
| 378 | + $args = wp_parse_args( $args, $defaults ); |
|
| 379 | 379 | |
| 380 | 380 | $query = array(); |
| 381 | 381 | self::get_ids_query( $where, $order_by, $limit, $unique, $args, $query ); |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | } elseif ( false !== strpos( $args['is_draft'], ',' ) ) { |
| 479 | 479 | $is_draft = array_reduce( |
| 480 | 480 | explode( ',', $args['is_draft'] ), |
| 481 | - function ( $total, $current ) { |
|
| 481 | + function( $total, $current ) { |
|
| 482 | 482 | if ( is_numeric( $current ) ) { |
| 483 | 483 | $total[] = absint( $current ); |
| 484 | 484 | } |
@@ -224,8 +224,8 @@ discard block |
||
| 224 | 224 | return $this->get_pagenum(); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - if ( isset( $this->_pagination_args[ $key ] ) ) { |
|
| 228 | - return $this->_pagination_args[ $key ]; |
|
| 227 | + if ( isset( $this->_pagination_args[$key] ) ) { |
|
| 228 | + return $this->_pagination_args[$key]; |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
@@ -270,8 +270,8 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | private function hidden_search_inputs( $param_name ) { |
| 273 | - if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
|
| 274 | - $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) ); |
|
| 273 | + if ( ! empty( $_REQUEST[$param_name] ) ) { |
|
| 274 | + $value = sanitize_text_field( wp_unslash( $_REQUEST[$param_name] ) ); |
|
| 275 | 275 | echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $value ) . '" />'; |
| 276 | 276 | } |
| 277 | 277 | } |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | echo "<ul class='subsubsub'>\n"; |
| 315 | 315 | foreach ( $views as $class => $view ) { |
| 316 | - $views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 316 | + $views[$class] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 317 | 317 | } |
| 318 | 318 | echo implode( " |</li>\n", $views ) . "</li>\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 319 | 319 | echo '</ul>'; |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | |
| 475 | 475 | $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; |
| 476 | 476 | foreach ( $actions as $action => $link ) { |
| 477 | - ++$i; |
|
| 477 | + ++ $i; |
|
| 478 | 478 | $sep = $i === $action_count ? '' : ' | '; |
| 479 | 479 | $out .= "<span class='$action'>$link$sep</span>"; |
| 480 | 480 | } |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | 'next' => __( 'Next page', 'formidable' ), |
| 698 | 698 | ); |
| 699 | 699 | |
| 700 | - return $labels[ $link ]; |
|
| 700 | + return $labels[$link]; |
|
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | private function current_url() { |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | |
| 788 | 788 | // If the primary column doesn't exist fall back to the |
| 789 | 789 | // first non-checkbox column. |
| 790 | - if ( ! isset( $columns[ $default ] ) ) { |
|
| 790 | + if ( ! isset( $columns[$default] ) ) { |
|
| 791 | 791 | $default = self::get_default_primary_column_name(); |
| 792 | 792 | } |
| 793 | 793 | |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | */ |
| 802 | 802 | $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); |
| 803 | 803 | |
| 804 | - if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { |
|
| 804 | + if ( empty( $column ) || ! isset( $columns[$column] ) ) { |
|
| 805 | 805 | $column = $default; |
| 806 | 806 | } |
| 807 | 807 | |
@@ -822,7 +822,7 @@ discard block |
||
| 822 | 822 | // In 4.3, we added a fourth argument for primary column. |
| 823 | 823 | $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); |
| 824 | 824 | foreach ( $this->_column_headers as $key => $value ) { |
| 825 | - $column_headers[ $key ] = $value; |
|
| 825 | + $column_headers[$key] = $value; |
|
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | return $column_headers; |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | $data[1] = false; |
| 856 | 856 | } |
| 857 | 857 | |
| 858 | - $sortable[ $id ] = $data; |
|
| 858 | + $sortable[$id] = $data; |
|
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | $primary = $this->get_primary_column_name(); |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | static $cb_counter = 1; |
| 914 | 914 | $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', 'formidable' ) . '</label>'; |
| 915 | 915 | $columns['cb'] .= '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />'; |
| 916 | - ++$cb_counter; |
|
| 916 | + ++ $cb_counter; |
|
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | foreach ( $columns as $column_key => $column_display_name ) { |
@@ -935,8 +935,8 @@ discard block |
||
| 935 | 935 | $class[] = 'column-primary'; |
| 936 | 936 | } |
| 937 | 937 | |
| 938 | - if ( isset( $sortable[ $column_key ] ) ) { |
|
| 939 | - list( $orderby, $desc_first ) = $sortable[ $column_key ]; |
|
| 938 | + if ( isset( $sortable[$column_key] ) ) { |
|
| 939 | + list( $orderby, $desc_first ) = $sortable[$column_key]; |
|
| 940 | 940 | |
| 941 | 941 | if ( $current_orderby == $orderby ) { |
| 942 | 942 | // The sorted column. The `aria-sort` attribute must be set only on the sorted column. |
@@ -1053,7 +1053,7 @@ discard block |
||
| 1053 | 1053 | * @return bool Returns true if the setting is not set or if it is not false; otherwise, returns false. |
| 1054 | 1054 | */ |
| 1055 | 1055 | protected function should_display( $args, $settings ) { |
| 1056 | - return ! isset( $args[ $settings ] ) || false !== $args[ $settings ]; |
|
| 1056 | + return ! isset( $args[$settings] ) || false !== $args[$settings]; |
|
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | 1059 | /** |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | if ( $new_val !== $value ) { |
| 219 | - $new_values[ $key ] = $new_val; |
|
| 219 | + $new_values[$key] = $new_val; |
|
| 220 | 220 | } |
| 221 | 221 | }//end foreach |
| 222 | 222 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | foreach ( $values as $value_key => $value ) { |
| 255 | 255 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
| 256 | - $new_values[ $value_key ] = $value; |
|
| 256 | + $new_values[$value_key] = $value; |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
@@ -338,15 +338,15 @@ discard block |
||
| 338 | 338 | $existing_keys = array_keys( $values['item_meta'] ); |
| 339 | 339 | foreach ( $all_fields as $fid ) { |
| 340 | 340 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
| 341 | - $values['item_meta'][ $fid->id ] = ''; |
|
| 341 | + $values['item_meta'][$fid->id] = ''; |
|
| 342 | 342 | } |
| 343 | - $field_array[ $fid->id ] = $fid; |
|
| 343 | + $field_array[$fid->id] = $fid; |
|
| 344 | 344 | } |
| 345 | 345 | unset( $all_fields ); |
| 346 | 346 | |
| 347 | 347 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 348 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
| 349 | - $field = $field_array[ $field_id ]; |
|
| 348 | + if ( isset( $field_array[$field_id] ) ) { |
|
| 349 | + $field = $field_array[$field_id]; |
|
| 350 | 350 | } else { |
| 351 | 351 | $field = FrmField::getOne( $field_id ); |
| 352 | 352 | } |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | continue; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
| 358 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
| 359 | 359 | if ( $is_settings_page ) { |
| 360 | 360 | self::get_settings_page_html( $values, $field ); |
| 361 | 361 | |
@@ -375,22 +375,22 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | foreach ( $update_options as $opt => $default ) { |
| 378 | - $field->field_options[ $opt ] = $values['field_options'][ $opt . '_' . $field_id ] ?? $default; |
|
| 379 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 378 | + $field->field_options[$opt] = $values['field_options'][$opt . '_' . $field_id] ?? $default; |
|
| 379 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 383 | 383 | |
| 384 | 384 | $new_field = array( |
| 385 | 385 | 'field_options' => $field->field_options, |
| 386 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 386 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 387 | 387 | ); |
| 388 | 388 | |
| 389 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 390 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 389 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
| 390 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 391 | 391 | if ( is_array( $option ) ) { |
| 392 | 392 | foreach ( $option as $key => $item ) { |
| 393 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 393 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | } |
@@ -420,8 +420,8 @@ discard block |
||
| 420 | 420 | */ |
| 421 | 421 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 422 | 422 | if ( $field->type === 'textarea' && |
| 423 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 424 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 423 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 424 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 425 | 425 | |
| 426 | 426 | $new_field['field_options']['max'] = ''; |
| 427 | 427 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
| 430 | 430 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
| 431 | 431 | */ |
| 432 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
| 432 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
| 433 | 433 | } |
| 434 | 434 | } |
| 435 | 435 | |
@@ -511,11 +511,11 @@ discard block |
||
| 511 | 511 | * @return void |
| 512 | 512 | */ |
| 513 | 513 | private static function get_settings_page_html( $values, &$field ) { |
| 514 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 514 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 515 | 515 | $prev_opts = array(); |
| 516 | 516 | $fallback_html = $field->field_options['custom_html'] ?? FrmFieldsHelper::get_default_html( $field->type ); |
| 517 | 517 | |
| 518 | - $field->field_options['custom_html'] = $values['field_options'][ 'custom_html_' . $field->id ] ?? $fallback_html; |
|
| 518 | + $field->field_options['custom_html'] = $values['field_options']['custom_html_' . $field->id] ?? $fallback_html; |
|
| 519 | 519 | } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) { |
| 520 | 520 | $prev_opts = $field->field_options; |
| 521 | 521 | } |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | ); |
| 541 | 541 | foreach ( $field_cols as $col => $default ) { |
| 542 | 542 | $default = $default === '' ? $field->{$col} : $default; |
| 543 | - $new_field[ $col ] = $values['field_options'][ $col . '_' . $field->id ] ?? $default; |
|
| 543 | + $new_field[$col] = $values['field_options'][$col . '_' . $field->id] ?? $default; |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) { |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | if ( ! isset( $form->options['trash_time'] ) || $form->options['trash_time'] < $delete_timestamp ) { |
| 735 | 735 | self::destroy( $form->id ); |
| 736 | 736 | if ( empty( $form->parent_form_id ) ) { |
| 737 | - ++$count; |
|
| 737 | + ++ $count; |
|
| 738 | 738 | } |
| 739 | 739 | } |
| 740 | 740 | |
@@ -961,16 +961,16 @@ discard block |
||
| 961 | 961 | foreach ( $results as $row ) { |
| 962 | 962 | if ( 'trash' != $row->status ) { |
| 963 | 963 | if ( $row->is_template ) { |
| 964 | - ++$counts['template']; |
|
| 964 | + ++ $counts['template']; |
|
| 965 | 965 | } else { |
| 966 | - ++$counts['published']; |
|
| 966 | + ++ $counts['published']; |
|
| 967 | 967 | } |
| 968 | 968 | } else { |
| 969 | - ++$counts['trash']; |
|
| 969 | + ++ $counts['trash']; |
|
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | if ( 'draft' == $row->status ) { |
| 973 | - ++$counts['draft']; |
|
| 973 | + ++ $counts['draft']; |
|
| 974 | 974 | } |
| 975 | 975 | |
| 976 | 976 | unset( $row ); |
@@ -1011,8 +1011,8 @@ discard block |
||
| 1011 | 1011 | self::maybe_get_form( $form ); |
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 1015 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 1014 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 1015 | + return $frm_vars['form_params'][$form->id]; |
|
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | 1018 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1041,15 +1041,15 @@ discard block |
||
| 1041 | 1041 | // If there are two forms on the same page, make sure not to submit both. |
| 1042 | 1042 | foreach ( $default_values as $var => $default ) { |
| 1043 | 1043 | if ( $var === 'action' ) { |
| 1044 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1044 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1045 | 1045 | } else { |
| 1046 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1046 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1047 | 1047 | } |
| 1048 | 1048 | unset( $var, $default ); |
| 1049 | 1049 | } |
| 1050 | 1050 | } else { |
| 1051 | 1051 | foreach ( $default_values as $var => $default ) { |
| 1052 | - $values[ $var ] = $default; |
|
| 1052 | + $values[$var] = $default; |
|
| 1053 | 1053 | unset( $var, $default ); |
| 1054 | 1054 | } |
| 1055 | 1055 | } |
@@ -1075,7 +1075,7 @@ discard block |
||
| 1075 | 1075 | 'sdir' => '', |
| 1076 | 1076 | ); |
| 1077 | 1077 | foreach ( $defaults as $var => $default ) { |
| 1078 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1078 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | 1081 | return $values; |
@@ -1103,7 +1103,7 @@ discard block |
||
| 1103 | 1103 | 'keep_post' => '', |
| 1104 | 1104 | ); |
| 1105 | 1105 | foreach ( $defaults as $var => $default ) { |
| 1106 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1106 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | 1109 | return $values; |
@@ -1217,7 +1217,7 @@ discard block |
||
| 1217 | 1217 | $form = $atts['form']; |
| 1218 | 1218 | $default = $atts['default'] ?? ''; |
| 1219 | 1219 | |
| 1220 | - return $form->options[ $atts['option'] ] ?? $default; |
|
| 1220 | + return $form->options[$atts['option']] ?? $default; |
|
| 1221 | 1221 | } |
| 1222 | 1222 | |
| 1223 | 1223 | /** |