@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | if ( $intent_is_processing ) { |
| 63 | 63 | // Append an additional processing message to the end of the success message. |
| 64 | - $filter = function ( $message ) { |
|
| 64 | + $filter = function( $message ) { |
|
| 65 | 65 | $stripe_settings = FrmStrpLiteAppHelper::get_settings(); |
| 66 | 66 | return $message . ( '<p>' . esc_html( $stripe_settings->settings->processing_message ) . '</p>' ); |
| 67 | 67 | }; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $atts['form'] = FrmForm::getOne( $atts['entry']->form_id ); |
| 171 | 171 | $atts['entry_id'] = $atts['entry']->id; |
| 172 | 172 | $opt = 'success_action'; |
| 173 | - $atts['conf_method'] = ! empty( $atts['form']->options[ $opt ] ) ? $atts['form']->options[ $opt ] : 'message'; |
|
| 173 | + $atts['conf_method'] = ! empty( $atts['form']->options[$opt] ) ? $atts['form']->options[$opt] : 'message'; |
|
| 174 | 174 | |
| 175 | 175 | $actions = FrmFormsController::get_met_on_submit_actions( $atts, 'create' ); |
| 176 | 176 | |
@@ -268,11 +268,11 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | public static function get_payment_intents( $name ) { |
| 270 | 270 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 271 | - if ( ! isset( $_POST[ $name ] ) ) { |
|
| 271 | + if ( ! isset( $_POST[$name] ) ) { |
|
| 272 | 272 | return array(); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - $intents = $_POST[ $name ]; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 275 | + $intents = $_POST[$name]; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 276 | 276 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $intents ); |
| 277 | 277 | return $intents; |
| 278 | 278 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | self::format_form_data( $form ); |
| 301 | 301 | |
| 302 | 302 | $form_id = absint( $form['form_id'] ); |
| 303 | - $intents = $form[ 'frmintent' . $form_id ] ?? array(); |
|
| 303 | + $intents = $form['frmintent' . $form_id] ?? array(); |
|
| 304 | 304 | |
| 305 | 305 | if ( ! $intents ) { |
| 306 | 306 | wp_die(); |
@@ -310,8 +310,8 @@ discard block |
||
| 310 | 310 | $intents = array( $intents ); |
| 311 | 311 | } else { |
| 312 | 312 | foreach ( $intents as $k => $intent ) { |
| 313 | - if ( is_array( $intent ) && isset( $intent[ $k ] ) ) { |
|
| 314 | - $intents[ $k ] = $intent[ $k ]; |
|
| 313 | + if ( is_array( $intent ) && isset( $intent[$k] ) ) { |
|
| 314 | + $intents[$k] = $intent[$k]; |
|
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | 317 | } |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | if ( $saved->metadata->action != $action->ID ) { |
| 375 | 375 | continue; |
| 376 | 376 | } |
| 377 | - $intents[ $k ] = array( |
|
| 377 | + $intents[$k] = array( |
|
| 378 | 378 | 'id' => $intent, |
| 379 | 379 | 'action' => $action->ID, |
| 380 | 380 | ); |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | if ( $k === 'item_meta' ) { |
| 423 | 423 | foreach ( $v as $f => $value ) { |
| 424 | 424 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
| 425 | - $entry->metas[ absint( $f ) ] = $value; |
|
| 425 | + $entry->metas[absint( $f )] = $value; |
|
| 426 | 426 | } |
| 427 | 427 | } else { |
| 428 | 428 | FrmAppHelper::sanitize_value( 'wp_kses_post', $v ); |
@@ -448,14 +448,14 @@ discard block |
||
| 448 | 448 | foreach ( $form as $input ) { |
| 449 | 449 | $key = $input['name']; |
| 450 | 450 | |
| 451 | - if ( isset( $formatted[ $key ] ) ) { |
|
| 452 | - if ( is_array( $formatted[ $key ] ) ) { |
|
| 453 | - $formatted[ $key ][] = $input['value']; |
|
| 451 | + if ( isset( $formatted[$key] ) ) { |
|
| 452 | + if ( is_array( $formatted[$key] ) ) { |
|
| 453 | + $formatted[$key][] = $input['value']; |
|
| 454 | 454 | } else { |
| 455 | - $formatted[ $key ] = array( $formatted[ $key ], $input['value'] ); |
|
| 455 | + $formatted[$key] = array( $formatted[$key], $input['value'] ); |
|
| 456 | 456 | } |
| 457 | 457 | } else { |
| 458 | - $formatted[ $key ] = $input['value']; |
|
| 458 | + $formatted[$key] = $input['value']; |
|
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | |
| 705 | 705 | foreach ( $actions as $k => $action ) { |
| 706 | 706 | $amount = self::get_amount_before_submit( compact( 'action', 'form' ) ); |
| 707 | - $actions[ $k ]->post_content['amount'] = $amount; |
|
| 707 | + $actions[$k]->post_content['amount'] = $amount; |
|
| 708 | 708 | } |
| 709 | 709 | } |
| 710 | 710 | |
@@ -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 | |
| 411 | 409 | return $list; |
@@ -577,17 +575,17 @@ discard block |
||
| 577 | 575 | continue; |
| 578 | 576 | } |
| 579 | 577 | |
| 580 | - $wp_plugin = $wp_plugins[ $folder ] ?? array(); |
|
| 578 | + $wp_plugin = $wp_plugins[$folder] ?? array(); |
|
| 581 | 579 | $wp_version = $wp_plugin['Version'] ?? '1.0'; |
| 582 | 580 | $plugin->slug = explode( '/', $folder )[0]; |
| 583 | 581 | |
| 584 | 582 | if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) { |
| 585 | - $transient->response[ $folder ] = $plugin; |
|
| 583 | + $transient->response[$folder] = $plugin; |
|
| 586 | 584 | } else { |
| 587 | - $transient->no_update[ $folder ] = $plugin; |
|
| 585 | + $transient->no_update[$folder] = $plugin; |
|
| 588 | 586 | } |
| 589 | 587 | |
| 590 | - $transient->checked[ $folder ] = $wp_version; |
|
| 588 | + $transient->checked[$folder] = $wp_version; |
|
| 591 | 589 | |
| 592 | 590 | }//end foreach |
| 593 | 591 | |
@@ -621,7 +619,7 @@ discard block |
||
| 621 | 619 | */ |
| 622 | 620 | protected static function is_installed( $plugin ) { |
| 623 | 621 | $all_plugins = self::get_plugins(); |
| 624 | - return isset( $all_plugins[ $plugin ] ); |
|
| 622 | + return isset( $all_plugins[$plugin] ); |
|
| 625 | 623 | } |
| 626 | 624 | |
| 627 | 625 | /** |
@@ -664,14 +662,14 @@ discard block |
||
| 664 | 662 | |
| 665 | 663 | $download_id = $plugin['id'] ?? 0; |
| 666 | 664 | |
| 667 | - if ( $download_id && ! isset( $version_info[ $download_id ]['package'] ) ) { |
|
| 665 | + if ( $download_id && ! isset( $version_info[$download_id]['package'] ) ) { |
|
| 668 | 666 | // if this addon is using its own license, get the update url |
| 669 | 667 | $addon_info = $api->get_api_info(); |
| 670 | 668 | |
| 671 | - $version_info[ $download_id ] = $addon_info[ $download_id ]; |
|
| 669 | + $version_info[$download_id] = $addon_info[$download_id]; |
|
| 672 | 670 | |
| 673 | 671 | if ( isset( $addon_info['error'] ) ) { |
| 674 | - $version_info[ $download_id ]['error'] = array( |
|
| 672 | + $version_info[$download_id]['error'] = array( |
|
| 675 | 673 | 'message' => $addon_info['error']['message'], |
| 676 | 674 | 'code' => $addon_info['error']['code'], |
| 677 | 675 | ); |
@@ -781,8 +779,8 @@ discard block |
||
| 781 | 779 | return $addon; |
| 782 | 780 | } |
| 783 | 781 | } |
| 784 | - } elseif ( isset( $addons[ $download_id ] ) ) { |
|
| 785 | - $plugin = $addons[ $download_id ]; |
|
| 782 | + } elseif ( isset( $addons[$download_id] ) ) { |
|
| 783 | + $plugin = $addons[$download_id]; |
|
| 786 | 784 | } |
| 787 | 785 | |
| 788 | 786 | return $plugin; |
@@ -853,7 +851,7 @@ discard block |
||
| 853 | 851 | self::set_addon_status( $addon ); |
| 854 | 852 | self::set_categories( $addon ); |
| 855 | 853 | |
| 856 | - $addons[ $id ] = $addon; |
|
| 854 | + $addons[$id] = $addon; |
|
| 857 | 855 | }//end foreach |
| 858 | 856 | } |
| 859 | 857 | |
@@ -1129,7 +1127,7 @@ discard block |
||
| 1129 | 1127 | */ |
| 1130 | 1128 | public static function ajax_activate_addon() { |
| 1131 | 1129 | self::process_addon_action( |
| 1132 | - function ( $plugin ) { |
|
| 1130 | + function( $plugin ) { |
|
| 1133 | 1131 | return self::handle_addon_action( $plugin, 'activate' ); |
| 1134 | 1132 | }, |
| 1135 | 1133 | array( 'FrmAddonsController', 'get_addon_activation_response' ) |
@@ -1154,7 +1152,7 @@ discard block |
||
| 1154 | 1152 | */ |
| 1155 | 1153 | public static function ajax_deactivate_addon() { |
| 1156 | 1154 | self::process_addon_action( |
| 1157 | - function ( $plugin ) { |
|
| 1155 | + function( $plugin ) { |
|
| 1158 | 1156 | return self::handle_addon_action( $plugin, 'deactivate' ); |
| 1159 | 1157 | } |
| 1160 | 1158 | ); |
@@ -1169,7 +1167,7 @@ discard block |
||
| 1169 | 1167 | */ |
| 1170 | 1168 | public static function ajax_uninstall_addon() { |
| 1171 | 1169 | self::process_addon_action( |
| 1172 | - function ( $plugin ) { |
|
| 1170 | + function( $plugin ) { |
|
| 1173 | 1171 | return self::handle_addon_action( $plugin, 'uninstall' ); |
| 1174 | 1172 | } |
| 1175 | 1173 | ); |
@@ -1577,7 +1575,7 @@ discard block |
||
| 1577 | 1575 | $addons = $api->get_api_info(); |
| 1578 | 1576 | |
| 1579 | 1577 | if ( is_array( $addons ) && array_key_exists( $addon_id, $addons ) ) { |
| 1580 | - $dates = $addons[ $addon_id ]; |
|
| 1578 | + $dates = $addons[$addon_id]; |
|
| 1581 | 1579 | $requires = FrmFormsHelper::get_plan_required( $dates ); |
| 1582 | 1580 | } |
| 1583 | 1581 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | 'sep' => ', ', |
| 59 | 59 | 'html' => false, |
| 60 | 60 | ); |
| 61 | - $atts = wp_parse_args( $atts, $defaults ); |
|
| 61 | + $atts = wp_parse_args( $atts, $defaults ); |
|
| 62 | 62 | |
| 63 | 63 | if ( $atts['html'] ) { |
| 64 | 64 | $atts['sep'] = ' '; |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | // validate the url format |
| 83 | 83 | if ( $value && ! preg_match( '/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value ) ) { |
| 84 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 84 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 85 | 85 | } elseif ( $this->field->required == '1' && empty( $value ) ) { // phpcs:ignore Universal.Operators.StrictComparisons |
| 86 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'blank' ); |
|
| 86 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'blank' ); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | return $errors; |
@@ -82,7 +82,8 @@ |
||
| 82 | 82 | // validate the url format |
| 83 | 83 | if ( $value && ! preg_match( '/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value ) ) { |
| 84 | 84 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
| 85 | - } elseif ( $this->field->required == '1' && empty( $value ) ) { // phpcs:ignore Universal.Operators.StrictComparisons |
|
| 85 | + } elseif ( $this->field->required == '1' && empty( $value ) ) { |
|
| 86 | +// phpcs:ignore Universal.Operators.StrictComparisons |
|
| 86 | 87 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'blank' ); |
| 87 | 88 | } |
| 88 | 89 | |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | * @return void |
| 62 | 62 | */ |
| 63 | 63 | private function _set( $param, $atts ) { |
| 64 | - if ( isset( $atts[ $param ] ) ) { |
|
| 65 | - $this->{$param} = $atts[ $param ]; |
|
| 64 | + if ( isset( $atts[$param] ) ) { |
|
| 65 | + $this->{$param} = $atts[$param]; |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | $exclude = array( 'field_obj', 'html' ); |
| 114 | 114 | |
| 115 | 115 | foreach ( $exclude as $ex ) { |
| 116 | - if ( isset( $atts[ $ex ] ) ) { |
|
| 117 | - unset( $this->pass_args[ $ex ] ); |
|
| 116 | + if ( isset( $atts[$ex] ) ) { |
|
| 117 | + unset( $this->pass_args[$ex] ); |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | * @return void |
| 129 | 129 | */ |
| 130 | 130 | private function set_from_field( $atts, $set ) { |
| 131 | - if ( isset( $atts[ $set['param'] ] ) ) { |
|
| 132 | - $this->{$set['param']} = $atts[ $set['param'] ]; |
|
| 131 | + if ( isset( $atts[$set['param']] ) ) { |
|
| 132 | + $this->{$set['param']} = $atts[$set['param']]; |
|
| 133 | 133 | } else { |
| 134 | 134 | $this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] ); |
| 135 | 135 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | private function replace_error_shortcode() { |
| 288 | 288 | $this->maybe_add_error_id(); |
| 289 | - $error = $this->pass_args['errors'][ 'field' . $this->field_id ] ?? false; |
|
| 289 | + $error = $this->pass_args['errors']['field' . $this->field_id] ?? false; |
|
| 290 | 290 | |
| 291 | 291 | if ( $error && ! str_contains( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) { |
| 292 | 292 | $error_body = self::get_error_body( $this->html ); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | * @return void |
| 333 | 333 | */ |
| 334 | 334 | private function maybe_add_error_id() { |
| 335 | - if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
| 335 | + if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
| 336 | 336 | return; |
| 337 | 337 | } |
| 338 | 338 | |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER ); |
| 425 | 425 | |
| 426 | 426 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 427 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 427 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
| 428 | 428 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 429 | 429 | |
| 430 | 430 | $replace_with = ''; |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | $replace_with = $this->replace_input_shortcode( $shortcode_atts ); |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - $this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html ); |
|
| 438 | + $this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html ); |
|
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | 441 | |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | */ |
| 458 | 458 | private function prepare_input_shortcode_atts( $shortcode_atts ) { |
| 459 | 459 | if ( isset( $shortcode_atts['opt'] ) ) { |
| 460 | - --$shortcode_atts['opt']; |
|
| 460 | + -- $shortcode_atts['opt']; |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | $field_class = $shortcode_atts['class'] ?? ''; |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | */ |
| 528 | 528 | private function get_field_div_classes() { |
| 529 | 529 | // Add error class |
| 530 | - $classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : ''; |
|
| 530 | + $classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : ''; |
|
| 531 | 531 | |
| 532 | 532 | // Add label position class |
| 533 | 533 | $settings = $this->field_obj->display_field_settings(); |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | // Add 'aria-invalid' attribute to the group if there are errors. |
| 613 | - if ( isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
| 613 | + if ( isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
| 614 | 614 | $attributes['aria-invalid'] = 'true'; |
| 615 | 615 | } |
| 616 | 616 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $content_before_channel_tag, |
| 108 | 108 | 1 |
| 109 | 109 | ); |
| 110 | - $xml_string = $content_before_channel_tag . substr( $xml_string, $channel_start_position ); |
|
| 110 | + $xml_string = $content_before_channel_tag . substr( $xml_string, $channel_start_position ); |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | ); |
| 200 | 200 | |
| 201 | 201 | if ( $term && is_array( $term ) ) { |
| 202 | - ++$imported['imported']['terms']; |
|
| 203 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
| 202 | + ++ $imported['imported']['terms']; |
|
| 203 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | unset( $term, $t ); |
@@ -262,11 +262,11 @@ discard block |
||
| 262 | 262 | if ( $form_id ) { |
| 263 | 263 | if ( empty( $form['parent_form_id'] ) ) { |
| 264 | 264 | // Don't include the repeater form in the imported count. |
| 265 | - ++$imported['imported']['forms']; |
|
| 265 | + ++ $imported['imported']['forms']; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // Keep track of whether this specific form was updated or not. |
| 269 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
| 269 | + $imported['form_status'][$form_id] = 'imported'; |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | // Update field ids/keys to new ones. |
| 282 | 282 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
| 283 | 283 | |
| 284 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
| 284 | + $imported['forms'][(int) $item->id] = $form_id; |
|
| 285 | 285 | |
| 286 | 286 | // Send pre 2.0 form options through function that creates actions. |
| 287 | 287 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -371,11 +371,11 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | if ( empty( $form['parent_form_id'] ) ) { |
| 373 | 373 | // Don't include the repeater form in the updated count. |
| 374 | - ++$imported['updated']['forms']; |
|
| 374 | + ++ $imported['updated']['forms']; |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | // Keep track of whether this specific form was updated or not |
| 378 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
| 378 | + $imported['form_status'][$form_id] = 'updated'; |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | /** |
@@ -388,8 +388,8 @@ discard block |
||
| 388 | 388 | $old_fields = array(); |
| 389 | 389 | |
| 390 | 390 | foreach ( $form_fields as $f ) { |
| 391 | - $old_fields[ $f->id ] = $f; |
|
| 392 | - $old_fields[ $f->field_key ] = $f->id; |
|
| 391 | + $old_fields[$f->id] = $f; |
|
| 392 | + $old_fields[$f->field_key] = $f->id; |
|
| 393 | 393 | unset( $f ); |
| 394 | 394 | } |
| 395 | 395 | |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
| 451 | 451 | if ( $parent_form_id ) { |
| 452 | - $child_forms[ $form_id ] = $parent_form_id; |
|
| 452 | + $child_forms[$form_id] = $parent_form_id; |
|
| 453 | 453 | } |
| 454 | 454 | } |
| 455 | 455 | |
@@ -464,9 +464,9 @@ discard block |
||
| 464 | 464 | */ |
| 465 | 465 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
| 466 | 466 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
| 467 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) { |
|
| 467 | + if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) { |
|
| 468 | 468 | // Update all children with this old parent_form_id |
| 469 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
| 469 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
| 470 | 470 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
| 471 | 471 | do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id ); |
| 472 | 472 | } |
@@ -502,34 +502,34 @@ discard block |
||
| 502 | 502 | |
| 503 | 503 | if ( $this_form ) { |
| 504 | 504 | // check for field to edit by field id |
| 505 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
| 505 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
| 506 | 506 | FrmField::update( $f['id'], $f ); |
| 507 | - ++$imported['updated']['fields']; |
|
| 507 | + ++ $imported['updated']['fields']; |
|
| 508 | 508 | |
| 509 | - unset( $form_fields[ $f['id'] ] ); |
|
| 509 | + unset( $form_fields[$f['id']] ); |
|
| 510 | 510 | |
| 511 | 511 | // Unset old field key. |
| 512 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 513 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 512 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 513 | + unset( $form_fields[$f['field_key']] ); |
|
| 514 | 514 | } |
| 515 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 516 | - $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; |
|
| 515 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 516 | + $keys_by_original_field_id[$f['id']] = $f['field_key']; |
|
| 517 | 517 | |
| 518 | 518 | $old_field_id = $f['id']; |
| 519 | 519 | |
| 520 | 520 | // check for field to edit by field key |
| 521 | 521 | unset( $f['id'] ); |
| 522 | 522 | |
| 523 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
| 524 | - ++$imported['updated']['fields']; |
|
| 523 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
| 524 | + ++ $imported['updated']['fields']; |
|
| 525 | 525 | |
| 526 | 526 | self::do_after_field_imported_action( $f, $form_fields, $old_field_id ); |
| 527 | 527 | |
| 528 | 528 | // Unset old field id. |
| 529 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); |
|
| 529 | + unset( $form_fields[$form_fields[$f['field_key']]] ); |
|
| 530 | 530 | |
| 531 | 531 | // Unset old field key. |
| 532 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 532 | + unset( $form_fields[$f['field_key']] ); |
|
| 533 | 533 | } else { |
| 534 | 534 | // If no matching field id or key in this form, create the field. |
| 535 | 535 | self::create_imported_field( $f, $imported ); |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | */ |
| 571 | 571 | private static function do_after_field_imported_action( $field_array, $form_fields, $old_field_id ) { |
| 572 | 572 | // Assign field array the update field's ID. |
| 573 | - $field_array['id'] = $form_fields[ $field_array['field_key'] ]; |
|
| 573 | + $field_array['id'] = $form_fields[$field_array['field_key']]; |
|
| 574 | 574 | |
| 575 | 575 | /** |
| 576 | 576 | * Fires when an existing field is imported. |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | * @param int $field_id |
| 582 | 582 | * @param int $old_field_id |
| 583 | 583 | */ |
| 584 | - do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[ $field_array['field_key'] ], $old_field_id ); |
|
| 584 | + do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[$field_array['field_key']], $old_field_id ); |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | /** |
@@ -695,8 +695,8 @@ discard block |
||
| 695 | 695 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
| 696 | 696 | $form_select = (int) $f['field_options']['form_select']; |
| 697 | 697 | |
| 698 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
| 699 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
| 698 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
| 699 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
| 700 | 700 | } |
| 701 | 701 | } |
| 702 | 702 | } |
@@ -720,8 +720,8 @@ discard block |
||
| 720 | 720 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
| 721 | 721 | $old_form = $f['field_options']['get_values_form']; |
| 722 | 722 | |
| 723 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
| 724 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
| 723 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
| 724 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
| 725 | 725 | } |
| 726 | 726 | } |
| 727 | 727 | } |
@@ -737,13 +737,13 @@ discard block |
||
| 737 | 737 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
| 738 | 738 | |
| 739 | 739 | foreach ( $update_values as $k => $v ) { |
| 740 | - $f[ $k ] = $v; |
|
| 740 | + $f[$k] = $v; |
|
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
| 744 | 744 | |
| 745 | 745 | foreach ( $update_values as $k => $v ) { |
| 746 | - $f[ $k ] = $v; |
|
| 746 | + $f[$k] = $v; |
|
| 747 | 747 | } |
| 748 | 748 | } |
| 749 | 749 | |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | $field = (array) $field; |
| 763 | 763 | $field_options = $field['field_options']; |
| 764 | 764 | |
| 765 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
| 765 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
| 766 | 766 | return array(); |
| 767 | 767 | } |
| 768 | 768 | |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | |
| 792 | 792 | // phpcs:ignore Universal.Operators.StrictComparisons |
| 793 | 793 | if ( $opt == $default_value ) { |
| 794 | - unset( $options[ $opt_key ] ); |
|
| 794 | + unset( $options[$opt_key] ); |
|
| 795 | 795 | break; |
| 796 | 796 | } |
| 797 | 797 | } |
@@ -822,7 +822,7 @@ discard block |
||
| 822 | 822 | |
| 823 | 823 | // phpcs:ignore Universal.Operators.StrictComparisons |
| 824 | 824 | if ( $new_id != false ) { |
| 825 | - ++$imported['imported']['fields']; |
|
| 825 | + ++ $imported['imported']['fields']; |
|
| 826 | 826 | do_action( 'frm_after_field_is_imported', $f, $new_id ); |
| 827 | 827 | } |
| 828 | 828 | } |
@@ -852,10 +852,10 @@ discard block |
||
| 852 | 852 | |
| 853 | 853 | $image_id = FrmProFileImport::import_attachment( $option['src'], $field_object ); |
| 854 | 854 | // Remove the src from options as it isn't required after import. |
| 855 | - unset( $field['options'][ $key ]['src'] ); |
|
| 855 | + unset( $field['options'][$key]['src'] ); |
|
| 856 | 856 | |
| 857 | 857 | if ( is_numeric( $image_id ) ) { |
| 858 | - $field['options'][ $key ]['image'] = $image_id; |
|
| 858 | + $field['options'][$key]['image'] = $image_id; |
|
| 859 | 859 | } |
| 860 | 860 | } |
| 861 | 861 | |
@@ -1050,8 +1050,8 @@ discard block |
||
| 1050 | 1050 | } else { |
| 1051 | 1051 | if ( $post['post_type'] === 'frm_display' ) { |
| 1052 | 1052 | $post['post_content'] = self::maybe_prepare_json_view_content( $post['post_content'] ); |
| 1053 | - } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][ $post['post_parent'] ] ) ) { |
|
| 1054 | - $post['post_parent'] = $imported['posts'][ $post['post_parent'] ]; |
|
| 1053 | + } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][$post['post_parent']] ) ) { |
|
| 1054 | + $post['post_parent'] = $imported['posts'][$post['post_parent']]; |
|
| 1055 | 1055 | } |
| 1056 | 1056 | // Create/update post now |
| 1057 | 1057 | $post_id = wp_insert_post( $post ); |
@@ -1062,7 +1062,7 @@ discard block |
||
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | 1064 | if ( str_contains( $post['post_content'], '[display-frm-data' ) || str_contains( $post['post_content'], '[formidable' ) ) { |
| 1065 | - $posts_with_shortcodes[ $post_id ] = $post; |
|
| 1065 | + $posts_with_shortcodes[$post_id] = $post; |
|
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | self::update_postmeta( $post, $post_id ); |
@@ -1070,20 +1070,20 @@ discard block |
||
| 1070 | 1070 | |
| 1071 | 1071 | $this_type = 'posts'; |
| 1072 | 1072 | |
| 1073 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
| 1074 | - $this_type = $post_types[ $post['post_type'] ]; |
|
| 1073 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
| 1074 | + $this_type = $post_types[$post['post_type']]; |
|
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | 1077 | if ( isset( $post['ID'] ) && (int) $post_id === (int) $post['ID'] ) { |
| 1078 | - ++$imported['updated'][ $this_type ]; |
|
| 1078 | + ++ $imported['updated'][$this_type]; |
|
| 1079 | 1079 | } else { |
| 1080 | - ++$imported['imported'][ $this_type ]; |
|
| 1080 | + ++ $imported['imported'][$this_type]; |
|
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | - $imported['posts'][ $old_id ] = $post_id; |
|
| 1083 | + $imported['posts'][$old_id] = $post_id; |
|
| 1084 | 1084 | |
| 1085 | 1085 | if ( $post['post_type'] === 'frm_display' ) { |
| 1086 | - $view_ids[ $old_id ] = $post_id; |
|
| 1086 | + $view_ids[$old_id] = $post_id; |
|
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | 1089 | do_action( 'frm_after_import_view', $post_id, $post ); |
@@ -1262,9 +1262,9 @@ discard block |
||
| 1262 | 1262 | $post['attachment_url'] = (string) $item->attachment_url; |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | - if ( $post['post_type'] === FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
| 1265 | + if ( $post['post_type'] === FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
| 1266 | 1266 | // update to new form id |
| 1267 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
| 1267 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | 1270 | // Don't allow default styles to take over a site's default style |
@@ -1301,8 +1301,8 @@ discard block |
||
| 1301 | 1301 | ); |
| 1302 | 1302 | |
| 1303 | 1303 | // Switch old form and field ids to new ones. |
| 1304 | - if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
| 1305 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
| 1304 | + if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
| 1305 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
| 1306 | 1306 | } else { |
| 1307 | 1307 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1308 | 1308 | |
@@ -1313,23 +1313,23 @@ discard block |
||
| 1313 | 1313 | } elseif ( 'frm_options' === $m['key'] ) { |
| 1314 | 1314 | |
| 1315 | 1315 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
| 1316 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
| 1317 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
| 1316 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
| 1317 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
| 1318 | 1318 | } |
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | 1321 | if ( ! empty( $m['value']['map_address_fields'] ) ) { |
| 1322 | 1322 | foreach ( $m['value']['map_address_fields'] as $address_field_key => $address_field_id ) { |
| 1323 | - if ( isset( $frm_duplicate_ids[ $address_field_id ] ) ) { |
|
| 1324 | - $m['value']['map_address_fields'][ $address_field_key ] = $frm_duplicate_ids[ $address_field_id ]; |
|
| 1323 | + if ( isset( $frm_duplicate_ids[$address_field_id] ) ) { |
|
| 1324 | + $m['value']['map_address_fields'][$address_field_key] = $frm_duplicate_ids[$address_field_id]; |
|
| 1325 | 1325 | } |
| 1326 | 1326 | } |
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | 1329 | if ( ! empty( $m['value']['calendar_options'] ) ) { |
| 1330 | 1330 | foreach ( $m['value']['calendar_options'] as $calendar_option_group_key => $calendar_option ) { |
| 1331 | - if ( isset( $frm_duplicate_ids[ $calendar_option['value'] ] ) ) { |
|
| 1332 | - $m['value']['calendar_options'][ $calendar_option_group_key ]['value'] = $frm_duplicate_ids[ $calendar_option['value'] ]; |
|
| 1331 | + if ( isset( $frm_duplicate_ids[$calendar_option['value']] ) ) { |
|
| 1332 | + $m['value']['calendar_options'][$calendar_option_group_key]['value'] = $frm_duplicate_ids[$calendar_option['value']]; |
|
| 1333 | 1333 | } |
| 1334 | 1334 | } |
| 1335 | 1335 | } |
@@ -1337,8 +1337,8 @@ discard block |
||
| 1337 | 1337 | if ( ! empty( $m['value']['timeline_options'] ) ) { |
| 1338 | 1338 | foreach ( $m['value']['timeline_options'] as $timeline_option_group_key => $timeline_group_option ) { |
| 1339 | 1339 | foreach ( $timeline_group_option as $timeline_option_key => $timeline_option ) { |
| 1340 | - if ( isset( $frm_duplicate_ids[ $timeline_option ] ) ) { |
|
| 1341 | - $m['value']['timeline_options'][ $timeline_option_group_key ][ $timeline_option_key ] = $frm_duplicate_ids[ $timeline_option ]; |
|
| 1340 | + if ( isset( $frm_duplicate_ids[$timeline_option] ) ) { |
|
| 1341 | + $m['value']['timeline_options'][$timeline_option_group_key][$timeline_option_key] = $frm_duplicate_ids[$timeline_option]; |
|
| 1342 | 1342 | } |
| 1343 | 1343 | } |
| 1344 | 1344 | } |
@@ -1347,8 +1347,8 @@ discard block |
||
| 1347 | 1347 | $check_dup_array = array(); |
| 1348 | 1348 | |
| 1349 | 1349 | if ( ! empty( $m['value']['order_by'] ) ) { |
| 1350 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
| 1351 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
| 1350 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
| 1351 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
| 1352 | 1352 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
| 1353 | 1353 | $check_dup_array[] = 'order_by'; |
| 1354 | 1354 | } |
@@ -1359,9 +1359,9 @@ discard block |
||
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | 1361 | foreach ( $check_dup_array as $check_k ) { |
| 1362 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
| 1363 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
| 1364 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
| 1362 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
| 1363 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
| 1364 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
| 1365 | 1365 | } |
| 1366 | 1366 | unset( $mk, $mv ); |
| 1367 | 1367 | } |
@@ -1374,7 +1374,7 @@ discard block |
||
| 1374 | 1374 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1375 | 1375 | } |
| 1376 | 1376 | |
| 1377 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
| 1377 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
| 1378 | 1378 | } |
| 1379 | 1379 | |
| 1380 | 1380 | /** |
@@ -1384,7 +1384,7 @@ discard block |
||
| 1384 | 1384 | * @return void |
| 1385 | 1385 | */ |
| 1386 | 1386 | private static function populate_layout( &$post, $layout ) { |
| 1387 | - $post['layout'][ (string) $layout->type ] = (string) $layout->data; |
|
| 1387 | + $post['layout'][(string) $layout->type] = (string) $layout->data; |
|
| 1388 | 1388 | } |
| 1389 | 1389 | |
| 1390 | 1390 | /** |
@@ -1415,11 +1415,11 @@ discard block |
||
| 1415 | 1415 | $name = (string) $c; |
| 1416 | 1416 | } |
| 1417 | 1417 | |
| 1418 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
| 1419 | - $post['tax_input'][ $taxonomy ] = array(); |
|
| 1418 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
| 1419 | + $post['tax_input'][$taxonomy] = array(); |
|
| 1420 | 1420 | } |
| 1421 | 1421 | |
| 1422 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
| 1422 | + $post['tax_input'][$taxonomy][] = $name; |
|
| 1423 | 1423 | unset( $name ); |
| 1424 | 1424 | }//end foreach |
| 1425 | 1425 | } |
@@ -1576,7 +1576,7 @@ discard block |
||
| 1576 | 1576 | $message = '<ul>'; |
| 1577 | 1577 | |
| 1578 | 1578 | foreach ( $result as $type => $results ) { |
| 1579 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
| 1579 | + if ( ! isset( $t_strings[$type] ) ) { |
|
| 1580 | 1580 | // only print imported and updated |
| 1581 | 1581 | continue; |
| 1582 | 1582 | } |
@@ -1589,7 +1589,7 @@ discard block |
||
| 1589 | 1589 | } |
| 1590 | 1590 | |
| 1591 | 1591 | if ( $s_message ) { |
| 1592 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
| 1592 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
| 1593 | 1593 | $message .= implode( ', ', $s_message ); |
| 1594 | 1594 | $message .= '</li>'; |
| 1595 | 1595 | } |
@@ -1641,8 +1641,8 @@ discard block |
||
| 1641 | 1641 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
| 1642 | 1642 | ); |
| 1643 | 1643 | |
| 1644 | - if ( isset( $strings[ $type ] ) ) { |
|
| 1645 | - $s_message[] = $strings[ $type ]; |
|
| 1644 | + if ( isset( $strings[$type] ) ) { |
|
| 1645 | + $s_message[] = $strings[$type]; |
|
| 1646 | 1646 | } else { |
| 1647 | 1647 | $string = ' ' . $m . ' ' . ucfirst( $type ); |
| 1648 | 1648 | |
@@ -1805,7 +1805,7 @@ discard block |
||
| 1805 | 1805 | |
| 1806 | 1806 | foreach ( $options as $key => $option ) { |
| 1807 | 1807 | if ( is_array( $option ) && ! empty( $option['image'] ) ) { |
| 1808 | - $options[ $key ]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1808 | + $options[$key]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1809 | 1809 | $updated = true; |
| 1810 | 1810 | } |
| 1811 | 1811 | } |
@@ -1845,8 +1845,8 @@ discard block |
||
| 1845 | 1845 | */ |
| 1846 | 1846 | private static function remove_defaults( $defaults, &$saved ) { |
| 1847 | 1847 | foreach ( $saved as $key => $value ) { |
| 1848 | - if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) { |
|
| 1849 | - unset( $saved[ $key ] ); |
|
| 1848 | + if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) { |
|
| 1849 | + unset( $saved[$key] ); |
|
| 1850 | 1850 | } |
| 1851 | 1851 | } |
| 1852 | 1852 | } |
@@ -1863,16 +1863,16 @@ discard block |
||
| 1863 | 1863 | * @return void |
| 1864 | 1864 | */ |
| 1865 | 1865 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
| 1866 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
| 1866 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
| 1867 | 1867 | return; |
| 1868 | 1868 | } |
| 1869 | 1869 | |
| 1870 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
| 1871 | - $default_html = $defaults[ $html_name ]; |
|
| 1870 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
| 1871 | + $default_html = $defaults[$html_name]; |
|
| 1872 | 1872 | |
| 1873 | 1873 | // phpcs:ignore Universal.Operators.StrictComparisons |
| 1874 | 1874 | if ( $old_html == $default_html ) { |
| 1875 | - unset( $options[ $html_name ] ); |
|
| 1875 | + unset( $options[$html_name] ); |
|
| 1876 | 1876 | |
| 1877 | 1877 | return; |
| 1878 | 1878 | } |
@@ -1881,7 +1881,7 @@ discard block |
||
| 1881 | 1881 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
| 1882 | 1882 | |
| 1883 | 1883 | if ( $old_html === $default_html ) { |
| 1884 | - unset( $options[ $html_name ] ); |
|
| 1884 | + unset( $options[$html_name] ); |
|
| 1885 | 1885 | } |
| 1886 | 1886 | } |
| 1887 | 1887 | |
@@ -1988,8 +1988,8 @@ discard block |
||
| 1988 | 1988 | ); |
| 1989 | 1989 | |
| 1990 | 1990 | foreach ( $post_settings as $post_setting ) { |
| 1991 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
| 1992 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
| 1991 | + if ( isset( $form_options[$post_setting] ) ) { |
|
| 1992 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
| 1993 | 1993 | } |
| 1994 | 1994 | unset( $post_setting ); |
| 1995 | 1995 | } |
@@ -2027,7 +2027,7 @@ discard block |
||
| 2027 | 2027 | if ( ! $exists ) { |
| 2028 | 2028 | // this isn't an email, but we need to use a class that will always be included |
| 2029 | 2029 | FrmDb::save_json_post( $new_action ); |
| 2030 | - ++$imported['imported']['actions']; |
|
| 2030 | + ++ $imported['imported']['actions']; |
|
| 2031 | 2031 | } |
| 2032 | 2032 | } |
| 2033 | 2033 | |
@@ -2061,12 +2061,12 @@ discard block |
||
| 2061 | 2061 | // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
| 2062 | 2062 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
| 2063 | 2063 | // Replace old IDs with new IDs |
| 2064 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
| 2064 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
| 2065 | 2065 | // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
| 2066 | 2066 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
| 2067 | 2067 | foreach ( $setting as $k => $val ) { |
| 2068 | 2068 | // Replace old IDs with new IDs |
| 2069 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
| 2069 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
| 2070 | 2070 | } |
| 2071 | 2071 | } |
| 2072 | 2072 | unset( $key, $setting ); |
@@ -2134,7 +2134,7 @@ discard block |
||
| 2134 | 2134 | |
| 2135 | 2135 | if ( ! $exists ) { |
| 2136 | 2136 | FrmDb::save_json_post( $new_notification ); |
| 2137 | - ++$imported['imported']['actions']; |
|
| 2137 | + ++ $imported['imported']['actions']; |
|
| 2138 | 2138 | } |
| 2139 | 2139 | unset( $new_notification ); |
| 2140 | 2140 | }//end foreach |
@@ -2156,8 +2156,8 @@ discard block |
||
| 2156 | 2156 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
| 2157 | 2157 | |
| 2158 | 2158 | foreach ( $delete_settings as $index ) { |
| 2159 | - if ( isset( $form_options[ $index ] ) ) { |
|
| 2160 | - unset( $form_options[ $index ] ); |
|
| 2159 | + if ( isset( $form_options[$index] ) ) { |
|
| 2160 | + unset( $form_options[$index] ); |
|
| 2161 | 2161 | } |
| 2162 | 2162 | } |
| 2163 | 2163 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -2228,13 +2228,13 @@ discard block |
||
| 2228 | 2228 | ); |
| 2229 | 2229 | |
| 2230 | 2230 | foreach ( $reply_fields as $f => $val ) { |
| 2231 | - if ( isset( $notification[ $f ] ) ) { |
|
| 2232 | - $atts[ $f ] = $notification[ $f ]; |
|
| 2231 | + if ( isset( $notification[$f] ) ) { |
|
| 2232 | + $atts[$f] = $notification[$f]; |
|
| 2233 | 2233 | |
| 2234 | - if ( 'custom' === $notification[ $f ] ) { |
|
| 2235 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
| 2236 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
| 2237 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
| 2234 | + if ( 'custom' === $notification[$f] ) { |
|
| 2235 | + $atts[$f] = $notification['cust_' . $f]; |
|
| 2236 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
| 2237 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
| 2238 | 2238 | } |
| 2239 | 2239 | } |
| 2240 | 2240 | unset( $f, $val ); |
@@ -2271,14 +2271,14 @@ discard block |
||
| 2271 | 2271 | foreach ( $atts['email_to'] as $key => $email_field ) { |
| 2272 | 2272 | |
| 2273 | 2273 | if ( is_numeric( $email_field ) ) { |
| 2274 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
| 2274 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
| 2275 | 2275 | } |
| 2276 | 2276 | |
| 2277 | 2277 | if ( str_contains( $email_field, '|' ) ) { |
| 2278 | 2278 | $email_opt = explode( '|', $email_field ); |
| 2279 | 2279 | |
| 2280 | 2280 | if ( isset( $email_opt[0] ) ) { |
| 2281 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 2281 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 2282 | 2282 | } |
| 2283 | 2283 | unset( $email_opt ); |
| 2284 | 2284 | } |
@@ -2309,12 +2309,12 @@ discard block |
||
| 2309 | 2309 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
| 2310 | 2310 | |
| 2311 | 2311 | foreach ( $add_fields as $add_field ) { |
| 2312 | - if ( isset( $notification[ $add_field ] ) ) { |
|
| 2313 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
| 2312 | + if ( isset( $notification[$add_field] ) ) { |
|
| 2313 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
| 2314 | 2314 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ), true ) ) { |
| 2315 | - $new_notification['post_content'][ $add_field ] = 0; |
|
| 2315 | + $new_notification['post_content'][$add_field] = 0; |
|
| 2316 | 2316 | } else { |
| 2317 | - $new_notification['post_content'][ $add_field ] = ''; |
|
| 2317 | + $new_notification['post_content'][$add_field] = ''; |
|
| 2318 | 2318 | } |
| 2319 | 2319 | unset( $add_field ); |
| 2320 | 2320 | } |
@@ -2340,7 +2340,7 @@ discard block |
||
| 2340 | 2340 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
| 2341 | 2341 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
| 2342 | 2342 | if ( is_numeric( $email_key ) ) { |
| 2343 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 2343 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 2344 | 2344 | } |
| 2345 | 2345 | unset( $email_key, $val ); |
| 2346 | 2346 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | return $this->get_pagenum(); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - return $this->_pagination_args[ $key ] ?? null; |
|
| 249 | + return $this->_pagination_args[$key] ?? null; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | * @return void |
| 296 | 296 | */ |
| 297 | 297 | private function hidden_search_inputs( $param_name ) { |
| 298 | - if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
|
| 299 | - $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) ); |
|
| 298 | + if ( ! empty( $_REQUEST[$param_name] ) ) { |
|
| 299 | + $value = sanitize_text_field( wp_unslash( $_REQUEST[$param_name] ) ); |
|
| 300 | 300 | echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $value ) . '" />'; |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | echo "<ul class='subsubsub'>\n"; |
| 340 | 340 | |
| 341 | 341 | foreach ( $views as $class => $view ) { |
| 342 | - $views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 342 | + $views[$class] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 343 | 343 | } |
| 344 | 344 | echo implode( " |</li>\n", $views ) . "</li>\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 345 | 345 | echo '</ul>'; |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; |
| 511 | 511 | |
| 512 | 512 | foreach ( $actions as $action => $link ) { |
| 513 | - ++$i; |
|
| 513 | + ++ $i; |
|
| 514 | 514 | $sep = $i === $action_count ? '' : ' | '; |
| 515 | 515 | $out .= "<span class='$action'>$link$sep</span>"; |
| 516 | 516 | } |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | 'next' => __( 'Next page', 'formidable' ), |
| 752 | 752 | ); |
| 753 | 753 | |
| 754 | - return $labels[ $link ]; |
|
| 754 | + return $labels[$link]; |
|
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | private function current_url() { |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | |
| 851 | 851 | // If the primary column doesn't exist fall back to the |
| 852 | 852 | // first non-checkbox column. |
| 853 | - if ( ! isset( $columns[ $default ] ) ) { |
|
| 853 | + if ( ! isset( $columns[$default] ) ) { |
|
| 854 | 854 | $default = self::get_default_primary_column_name(); |
| 855 | 855 | } |
| 856 | 856 | |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | */ |
| 865 | 865 | $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); |
| 866 | 866 | |
| 867 | - if ( ! $column || ! isset( $columns[ $column ] ) ) { |
|
| 867 | + if ( ! $column || ! isset( $columns[$column] ) ) { |
|
| 868 | 868 | $column = $default; |
| 869 | 869 | } |
| 870 | 870 | |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); |
| 887 | 887 | |
| 888 | 888 | foreach ( $this->_column_headers as $key => $value ) { |
| 889 | - $column_headers[ $key ] = $value; |
|
| 889 | + $column_headers[$key] = $value; |
|
| 890 | 890 | } |
| 891 | 891 | |
| 892 | 892 | return $column_headers; |
@@ -921,7 +921,7 @@ discard block |
||
| 921 | 921 | $data[1] = false; |
| 922 | 922 | } |
| 923 | 923 | |
| 924 | - $sortable[ $id ] = $data; |
|
| 924 | + $sortable[$id] = $data; |
|
| 925 | 925 | } |
| 926 | 926 | |
| 927 | 927 | $primary = $this->get_primary_column_name(); |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | static $cb_counter = 1; |
| 973 | 973 | $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', 'formidable' ) . '</label>'; |
| 974 | 974 | $columns['cb'] .= '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />'; |
| 975 | - ++$cb_counter; |
|
| 975 | + ++ $cb_counter; |
|
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | foreach ( $columns as $column_key => $column_display_name ) { |
@@ -995,8 +995,8 @@ discard block |
||
| 995 | 995 | $class[] = 'column-primary'; |
| 996 | 996 | } |
| 997 | 997 | |
| 998 | - if ( isset( $sortable[ $column_key ] ) ) { |
|
| 999 | - list( $orderby, $desc_first ) = $sortable[ $column_key ]; |
|
| 998 | + if ( isset( $sortable[$column_key] ) ) { |
|
| 999 | + list( $orderby, $desc_first ) = $sortable[$column_key]; |
|
| 1000 | 1000 | |
| 1001 | 1001 | // phpcs:ignore Universal.Operators.StrictComparisons |
| 1002 | 1002 | if ( $current_orderby == $orderby ) { |
@@ -1117,7 +1117,7 @@ discard block |
||
| 1117 | 1117 | * @return bool Returns true if the setting is not set or if it is not false; otherwise, returns false. |
| 1118 | 1118 | */ |
| 1119 | 1119 | protected function should_display( $args, $settings ) { |
| 1120 | - return ! isset( $args[ $settings ] ) || false !== $args[ $settings ]; |
|
| 1120 | + return ! isset( $args[$settings] ) || false !== $args[$settings]; |
|
| 1121 | 1121 | } |
| 1122 | 1122 | |
| 1123 | 1123 | /** |
@@ -61,21 +61,21 @@ discard block |
||
| 61 | 61 | // Find the opening parenthesis after empty. |
| 62 | 62 | $openParen = $phpcsFile->findNext( T_WHITESPACE, $stackPtr + 1, null, true ); |
| 63 | 63 | |
| 64 | - if ( false === $openParen || $tokens[ $openParen ]['code'] !== T_OPEN_PARENTHESIS ) { |
|
| 64 | + if ( false === $openParen || $tokens[$openParen]['code'] !== T_OPEN_PARENTHESIS ) { |
|
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // Find the variable inside empty(). |
| 69 | 69 | $variablePtr = $phpcsFile->findNext( T_WHITESPACE, $openParen + 1, null, true ); |
| 70 | 70 | |
| 71 | - if ( false === $variablePtr || $tokens[ $variablePtr ]['code'] !== T_VARIABLE ) { |
|
| 71 | + if ( false === $variablePtr || $tokens[$variablePtr]['code'] !== T_VARIABLE ) { |
|
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - $variableName = $tokens[ $variablePtr ]['content']; |
|
| 75 | + $variableName = $tokens[$variablePtr]['content']; |
|
| 76 | 76 | |
| 77 | 77 | // Check if there's anything else inside the empty() call (like array access). |
| 78 | - $closeParen = $tokens[ $openParen ]['parenthesis_closer']; |
|
| 78 | + $closeParen = $tokens[$openParen]['parenthesis_closer']; |
|
| 79 | 79 | $nextToken = $phpcsFile->findNext( T_WHITESPACE, $variablePtr + 1, $closeParen, true ); |
| 80 | 80 | |
| 81 | 81 | if ( false !== $nextToken ) { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | // Check if there's a boolean NOT before empty. |
| 100 | 100 | $prevToken = $phpcsFile->findPrevious( T_WHITESPACE, $stackPtr - 1, null, true ); |
| 101 | - $isNegated = ( false !== $prevToken && $tokens[ $prevToken ]['code'] === T_BOOLEAN_NOT ); |
|
| 101 | + $isNegated = ( false !== $prevToken && $tokens[$prevToken]['code'] === T_BOOLEAN_NOT ); |
|
| 102 | 102 | |
| 103 | 103 | // Determine the suggested replacement. |
| 104 | 104 | if ( $isNegated ) { |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | $phpcsFile->fixer->replaceToken( $prevToken, '' ); |
| 125 | 125 | |
| 126 | 126 | // Remove any whitespace between "!" and "empty". |
| 127 | - for ( $i = $prevToken + 1; $i < $stackPtr; $i++ ) { |
|
| 128 | - if ( $tokens[ $i ]['code'] === T_WHITESPACE ) { |
|
| 127 | + for ( $i = $prevToken + 1; $i < $stackPtr; $i ++ ) { |
|
| 128 | + if ( $tokens[$i]['code'] === T_WHITESPACE ) { |
|
| 129 | 129 | $phpcsFile->fixer->replaceToken( $i, '' ); |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | $phpcsFile->fixer->replaceToken( $stackPtr, '' ); |
| 136 | 136 | |
| 137 | 137 | // Remove whitespace after empty. |
| 138 | - for ( $i = $stackPtr + 1; $i < $openParen; $i++ ) { |
|
| 139 | - if ( $tokens[ $i ]['code'] === T_WHITESPACE ) { |
|
| 138 | + for ( $i = $stackPtr + 1; $i < $openParen; $i ++ ) { |
|
| 139 | + if ( $tokens[$i]['code'] === T_WHITESPACE ) { |
|
| 140 | 140 | $phpcsFile->fixer->replaceToken( $i, '' ); |
| 141 | 141 | } |
| 142 | 142 | } |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | // Remove whitespace after opening paren. |
| 148 | 148 | $nextAfterOpen = $openParen + 1; |
| 149 | 149 | |
| 150 | - while ( $nextAfterOpen < $variablePtr && $tokens[ $nextAfterOpen ]['code'] === T_WHITESPACE ) { |
|
| 150 | + while ( $nextAfterOpen < $variablePtr && $tokens[$nextAfterOpen]['code'] === T_WHITESPACE ) { |
|
| 151 | 151 | $phpcsFile->fixer->replaceToken( $nextAfterOpen, '' ); |
| 152 | - ++$nextAfterOpen; |
|
| 152 | + ++ $nextAfterOpen; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | // Keep the variable, but add "! " prefix if not negated. |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | // Remove whitespace before closing paren. |
| 161 | 161 | $prevBeforeClose = $closeParen - 1; |
| 162 | 162 | |
| 163 | - while ( $prevBeforeClose > $variablePtr && $tokens[ $prevBeforeClose ]['code'] === T_WHITESPACE ) { |
|
| 163 | + while ( $prevBeforeClose > $variablePtr && $tokens[$prevBeforeClose]['code'] === T_WHITESPACE ) { |
|
| 164 | 164 | $phpcsFile->fixer->replaceToken( $prevBeforeClose, '' ); |
| 165 | - --$prevBeforeClose; |
|
| 165 | + -- $prevBeforeClose; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // Replace closing paren. |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | $tokens = $phpcsFile->getTokens(); |
| 185 | 185 | |
| 186 | 186 | // Find the opening parenthesis that contains this empty() call. |
| 187 | - for ( $i = $stackPtr - 1; $i >= 0; $i-- ) { |
|
| 188 | - $code = $tokens[ $i ]['code']; |
|
| 187 | + for ( $i = $stackPtr - 1; $i >= 0; $i -- ) { |
|
| 188 | + $code = $tokens[$i]['code']; |
|
| 189 | 189 | |
| 190 | 190 | // Skip whitespace and the "!" operator. |
| 191 | 191 | if ( $code === T_WHITESPACE || $code === T_BOOLEAN_NOT ) { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $beforeParen = $phpcsFile->findPrevious( T_WHITESPACE, $i - 1, null, true ); |
| 198 | 198 | |
| 199 | 199 | if ( false !== $beforeParen ) { |
| 200 | - $beforeCode = $tokens[ $beforeParen ]['code']; |
|
| 200 | + $beforeCode = $tokens[$beforeParen]['code']; |
|
| 201 | 201 | |
| 202 | 202 | if ( $beforeCode === T_IF || $beforeCode === T_ELSEIF ) { |
| 203 | 203 | return true; |
@@ -227,10 +227,10 @@ discard block |
||
| 227 | 227 | private function findContainingFunction( File $phpcsFile, $stackPtr ) { |
| 228 | 228 | $tokens = $phpcsFile->getTokens(); |
| 229 | 229 | |
| 230 | - for ( $i = $stackPtr - 1; $i >= 0; $i-- ) { |
|
| 231 | - if ( $tokens[ $i ]['code'] === T_FUNCTION || $tokens[ $i ]['code'] === T_CLOSURE ) { |
|
| 232 | - if ( isset( $tokens[ $i ]['scope_opener'], $tokens[ $i ]['scope_closer'] ) ) { |
|
| 233 | - if ( $stackPtr > $tokens[ $i ]['scope_opener'] && $stackPtr < $tokens[ $i ]['scope_closer'] ) { |
|
| 230 | + for ( $i = $stackPtr - 1; $i >= 0; $i -- ) { |
|
| 231 | + if ( $tokens[$i]['code'] === T_FUNCTION || $tokens[$i]['code'] === T_CLOSURE ) { |
|
| 232 | + if ( isset( $tokens[$i]['scope_opener'], $tokens[$i]['scope_closer'] ) ) { |
|
| 233 | + if ( $stackPtr > $tokens[$i]['scope_opener'] && $stackPtr < $tokens[$i]['scope_closer'] ) { |
|
| 234 | 234 | return $i; |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | private function wasVariableUnconditionallyAssigned( File $phpcsFile, $functionToken, $emptyPtr, $variableName ) { |
| 257 | 257 | $tokens = $phpcsFile->getTokens(); |
| 258 | - $scopeOpener = $tokens[ $functionToken ]['scope_opener']; |
|
| 258 | + $scopeOpener = $tokens[$functionToken]['scope_opener']; |
|
| 259 | 259 | |
| 260 | 260 | // Find the if/elseif statement that contains the empty() call. |
| 261 | 261 | $ifToken = $this->findContainingIf( $phpcsFile, $emptyPtr ); |
@@ -265,28 +265,28 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | // The if statement's level is what we compare against. |
| 268 | - $ifLevel = $tokens[ $ifToken ]['level']; |
|
| 268 | + $ifLevel = $tokens[$ifToken]['level']; |
|
| 269 | 269 | |
| 270 | 270 | // Search from the function start to the if statement (not the empty call). |
| 271 | - for ( $i = $scopeOpener + 1; $i < $ifToken; $i++ ) { |
|
| 272 | - if ( $tokens[ $i ]['code'] !== T_VARIABLE ) { |
|
| 271 | + for ( $i = $scopeOpener + 1; $i < $ifToken; $i ++ ) { |
|
| 272 | + if ( $tokens[$i]['code'] !== T_VARIABLE ) { |
|
| 273 | 273 | continue; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - if ( $tokens[ $i ]['content'] !== $variableName ) { |
|
| 276 | + if ( $tokens[$i]['content'] !== $variableName ) { |
|
| 277 | 277 | continue; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | // Check if this variable is being assigned (has = after it). |
| 281 | 281 | $nextToken = $phpcsFile->findNext( T_WHITESPACE, $i + 1, null, true ); |
| 282 | 282 | |
| 283 | - if ( false === $nextToken || $tokens[ $nextToken ]['code'] !== T_EQUAL ) { |
|
| 283 | + if ( false === $nextToken || $tokens[$nextToken]['code'] !== T_EQUAL ) { |
|
| 284 | 284 | continue; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | // Check if the assignment is at the same scope level as the if statement. |
| 288 | 288 | // This ensures the variable was assigned unconditionally before the if. |
| 289 | - $assignmentLevel = $tokens[ $i ]['level']; |
|
| 289 | + $assignmentLevel = $tokens[$i]['level']; |
|
| 290 | 290 | |
| 291 | 291 | if ( $assignmentLevel === $ifLevel ) { |
| 292 | 292 | return true; |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | private function findContainingIf( File $phpcsFile, $stackPtr ) { |
| 308 | 308 | $tokens = $phpcsFile->getTokens(); |
| 309 | 309 | |
| 310 | - for ( $i = $stackPtr - 1; $i >= 0; $i-- ) { |
|
| 311 | - $code = $tokens[ $i ]['code']; |
|
| 310 | + for ( $i = $stackPtr - 1; $i >= 0; $i -- ) { |
|
| 311 | + $code = $tokens[$i]['code']; |
|
| 312 | 312 | |
| 313 | 313 | if ( $code === T_IF || $code === T_ELSEIF ) { |
| 314 | 314 | return $i; |