Completed
Pull Request — master (#1304)
by Stephanie
46s
created
classes/controllers/FrmFormsController.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -546,11 +546,11 @@  discard block
 block discarded – undo
546 546
 			),
547 547
 		);
548 548
 
549
-		if ( ! isset( $available_status[ $status ] ) ) {
549
+		if ( ! isset( $available_status[$status] ) ) {
550 550
 			return;
551 551
 		}
552 552
 
553
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
553
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
554 554
 
555 555
 		$params = FrmForm::list_page_params();
556 556
 
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 		check_admin_referer( $status . '_form_' . $params['id'] );
559 559
 
560 560
 		$count = 0;
561
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
561
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
562 562
 			$count ++;
563 563
 		}
564 564
 
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 		/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
576 576
 		$available_status['trash']['message']   = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type=' . $form_type . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
577 577
 
578
-		$message = $available_status[ $status ]['message'];
578
+		$message = $available_status[$status]['message'];
579 579
 
580 580
 		self::display_forms_list( $params, $message );
581 581
 	}
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 				'type'  => 'request',
597 597
 			)
598 598
 		);
599
-		$message      = sprintf(
599
+		$message = sprintf(
600 600
 			/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
601 601
 			_n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ),
602 602
 			$count,
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
 
1146 1146
 		foreach ( array( 'landing', 'chat', 'abandonment' ) as $feature ) {
1147 1147
 			if ( ! FrmAppHelper::show_new_feature( $feature ) ) {
1148
-				unset( $sections[ $feature ] );
1148
+				unset( $sections[$feature] );
1149 1149
 			}
1150 1150
 		}
1151 1151
 
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
 				$section['id'] = $section['anchor'];
1179 1179
 			}
1180 1180
 
1181
-			$sections[ $key ] = $section;
1181
+			$sections[$key] = $section;
1182 1182
 		}
1183 1183
 
1184 1184
 		return $sections;
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
 		if ( ! empty( $user_fields ) ) {
1297 1297
 			$user_helpers = array();
1298 1298
 			foreach ( $user_fields as $uk => $uf ) {
1299
-				$user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
1299
+				$user_helpers['|user_id| show="' . $uk . '"'] = $uf;
1300 1300
 				unset( $uk, $uf );
1301 1301
 			}
1302 1302
 
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
 		if ( ! isset( $frm_vars['js_validate_forms'] ) ) {
1436 1436
 			$frm_vars['js_validate_forms'] = array();
1437 1437
 		}
1438
-		$frm_vars['js_validate_forms'][ $form->id ] = $form;
1438
+		$frm_vars['js_validate_forms'][$form->id] = $form;
1439 1439
 	}
1440 1440
 
1441 1441
 	public static function get_email_html() {
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1595 1595
 			} else {
1596 1596
 				$vars   = FrmAppHelper::json_to_array( $json_vars );
1597
-				$action = $vars[ $action ];
1597
+				$action = $vars[$action];
1598 1598
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1599 1599
 				$_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1600 1600
 				$_POST    = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
 		$actions = array();
1754 1754
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
1755 1755
 			if ( is_object( $form ) ) {
1756
-				$actions[ $form->id ] = $form->name;
1756
+				$actions[$form->id] = $form->name;
1757 1757
 			}
1758 1758
 			unset( $form );
1759 1759
 		}
@@ -1997,8 +1997,8 @@  discard block
 block discarded – undo
1997 1997
 	private static function get_saved_errors( $form, $params ) {
1998 1998
 		global $frm_vars;
1999 1999
 
2000
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2001
-			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
2000
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2001
+			$errors = $frm_vars['created_entries'][$form->id]['errors'];
2002 2002
 		} else {
2003 2003
 			$errors = array();
2004 2004
 		}
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
 	public static function just_created_entry( $form_id ) {
2021 2021
 		global $frm_vars;
2022 2022
 
2023
-		return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form_id ] ) && isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) ? $frm_vars['created_entries'][ $form_id ]['entry_id'] : 0;
2023
+		return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form_id] ) && isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) ? $frm_vars['created_entries'][$form_id]['entry_id'] : 0;
2024 2024
 	}
2025 2025
 
2026 2026
 	/**
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
 	private static function get_confirmation_method( $atts ) {
2041 2041
 		$action = FrmOnSubmitHelper::current_event( $atts );
2042 2042
 		$opt    = 'update' === $action ? 'edit_action' : 'success_action';
2043
-		$method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message';
2043
+		$method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message';
2044 2044
 
2045 2045
 		if ( ! empty( $atts['entry_id'] ) ) {
2046 2046
 			$met_actions = self::get_met_on_submit_actions( $atts, $action );
@@ -2061,7 +2061,7 @@  discard block
 block discarded – undo
2061 2061
 	public static function maybe_trigger_redirect( $form, $params, $args ) {
2062 2062
 		if ( ! isset( $params['id'] ) ) {
2063 2063
 			global $frm_vars;
2064
-			$params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
2064
+			$params['id'] = $frm_vars['created_entries'][$form->id]['entry_id'];
2065 2065
 		}
2066 2066
 
2067 2067
 		$conf_method = self::get_confirmation_method(
@@ -2143,7 +2143,7 @@  discard block
 block discarded – undo
2143 2143
 		$args['success_opt'] = $opt;
2144 2144
 		$args['ajax']        = ! empty( $frm_vars['ajax'] );
2145 2145
 
2146
-		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) {
2146
+		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) {
2147 2147
 			self::load_page_after_submit( $args );
2148 2148
 		} elseif ( $args['conf_method'] === 'redirect' ) {
2149 2149
 			self::redirect_after_submit( $args );
@@ -2167,7 +2167,7 @@  discard block
 block discarded – undo
2167 2167
 		}
2168 2168
 
2169 2169
 		// If a redirect action has already opened the URL in a new tab, we show the default message in the currect tab.
2170
-		if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) {
2170
+		if ( ! empty( self::$redirected_in_new_tab[$args['form']->id] ) ) {
2171 2171
 			return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) );
2172 2172
 		}
2173 2173
 
@@ -2354,7 +2354,7 @@  discard block
 block discarded – undo
2354 2354
 
2355 2355
 		$opt = 'update' === $args['action'] ? 'edit_' : 'success_';
2356 2356
 
2357
-		$new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ];
2357
+		$new_args['conf_method'] = $new_args['form']->options[$opt . 'action'];
2358 2358
 
2359 2359
 		/**
2360 2360
 		 * Filters the run success action args.
@@ -2374,8 +2374,8 @@  discard block
 block discarded – undo
2374 2374
 	private static function load_page_after_submit( $args ) {
2375 2375
 		global $post;
2376 2376
 		$opt = $args['success_opt'];
2377
-		if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
2378
-			$page     = get_post( $args['form']->options[ $opt . '_page_id' ] );
2377
+		if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) {
2378
+			$page     = get_post( $args['form']->options[$opt . '_page_id'] );
2379 2379
 			$old_post = $post;
2380 2380
 			$post     = $page;
2381 2381
 			$content  = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] );
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
 		add_filter( 'frm_use_wpautop', '__return_false' );
2406 2406
 
2407 2407
 		$opt         = $args['success_opt'];
2408
-		$success_url = trim( $args['form']->options[ $opt . '_url' ] );
2408
+		$success_url = trim( $args['form']->options[$opt . '_url'] );
2409 2409
 		$success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] );
2410 2410
 		$success_url = do_shortcode( $success_url );
2411 2411
 
@@ -2425,7 +2425,7 @@  discard block
 block discarded – undo
2425 2425
 		if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { // Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2426 2426
 			if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
2427 2427
 				self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args );
2428
-				self::$redirected_in_new_tab[ $args['form']->id ] = 1;
2428
+				self::$redirected_in_new_tab[$args['form']->id] = 1;
2429 2429
 				return;
2430 2430
 			}
2431 2431
 
@@ -2685,7 +2685,7 @@  discard block
 block discarded – undo
2685 2685
 			'description' => false,
2686 2686
 			'reset'       => false,
2687 2687
 		);
2688
-		$args     = wp_parse_args( $args, $defaults );
2688
+		$args = wp_parse_args( $args, $defaults );
2689 2689
 	}
2690 2690
 
2691 2691
 	/**
@@ -2723,7 +2723,7 @@  discard block
 block discarded – undo
2723 2723
 		$opt          = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success';
2724 2724
 
2725 2725
 		if ( $entry_id && is_numeric( $entry_id ) ) {
2726
-			$message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg;
2726
+			$message = isset( $form->options[$opt . '_msg'] ) ? $form->options[$opt . '_msg'] : $frm_settings->success_msg;
2727 2727
 			$class   = 'frm_message';
2728 2728
 		} else {
2729 2729
 			$message = $frm_settings->failed_msg;
@@ -2947,7 +2947,7 @@  discard block
 block discarded – undo
2947 2947
 
2948 2948
 		check_ajax_referer( 'frm_ajax', 'nonce' );
2949 2949
 
2950
-		$html             = FrmAppHelper::clip(
2950
+		$html = FrmAppHelper::clip(
2951 2951
 			function() {
2952 2952
 				FrmAppHelper::maybe_autocomplete_pages_options(
2953 2953
 					array(
Please login to merge, or discard this patch.
classes/controllers/FrmAppController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -388,7 +388,7 @@
 block discarded – undo
388 388
 	 * @return void
389 389
 	 */
390 390
 	public static function api_email_form( $form_key, $title, $description ) {
391
-		$user        = wp_get_current_user();
391
+		$user = wp_get_current_user();
392 392
 		$args = array(
393 393
 			'api_url'     => 'https://sandbox.formidableforms.com/api/wp-json/frm/v2/forms/' . $form_key . '?return=html&exclude_script=jquery&exclude_style=formidable-css',
394 394
 			'title'       => $title,
Please login to merge, or discard this patch.
classes/helpers/FrmTipsHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 			'page'  => '',
46 46
 			'class' => 'frm-mt-0',
47 47
 		);
48
-		$tip      = array_merge( $defaults, $tip );
48
+		$tip = array_merge( $defaults, $tip );
49 49
 
50 50
 		if ( isset( $tip['link'] ) && ! isset( $tip['link']['medium'] ) ) {
51 51
 			$tip['link']['medium'] = 'tip';
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 * @return array
373 373
 	 */
374 374
 	public static function get_banner_tip() {
375
-		$tips       = array(
375
+		$tips = array(
376 376
 			array(
377 377
 				'link' => array(
378 378
 					'medium'  => 'banner',
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 			),
400 400
 		);
401 401
 		$random     = rand( 0, count( $tips ) - 1 );
402
-		$tip        = $tips[ $random ];
402
+		$tip        = $tips[$random];
403 403
 		$tip['num'] = $random;
404 404
 
405 405
 		return $tip;
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	public static function get_random_tip( $tips ) {
409 409
 		$random = rand( 0, count( $tips ) - 1 );
410 410
 
411
-		return $tips[ $random ];
411
+		return $tips[$random];
412 412
 	}
413 413
 
414 414
 	/**
Please login to merge, or discard this patch.
classes/helpers/FrmFormsHelper.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 			'class'        => '',
29 29
 			'inc_children' => 'exclude',
30 30
 		);
31
-		$args     = wp_parse_args( $args, $defaults );
31
+		$args = wp_parse_args( $args, $defaults );
32 32
 
33 33
 		if ( ! $args['field_id'] ) {
34 34
 			$args['field_id'] = $field_name;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public static function add_html_attr( $class, $param, &$add_html ) {
72 72
 		if ( ! empty( $class ) ) {
73
-			$add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
73
+			$add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
74 74
 		}
75 75
 	}
76 76
 
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 			'description' => '',
294 294
 		);
295 295
 		foreach ( $defaults as $var => $default ) {
296
-			if ( ! isset( $values[ $var ] ) ) {
297
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
296
+			if ( ! isset( $values[$var] ) ) {
297
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
298 298
 			}
299 299
 		}
300 300
 
@@ -309,8 +309,8 @@  discard block
 block discarded – undo
309 309
 			'parent_form_id' => 0,
310 310
 		);
311 311
 		foreach ( $defaults as $var => $default ) {
312
-			if ( ! isset( $values[ $var ] ) ) {
313
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
312
+			if ( ! isset( $values[$var] ) ) {
313
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
314 314
 			}
315 315
 		}
316 316
 		unset( $defaults );
@@ -347,16 +347,16 @@  discard block
 block discarded – undo
347 347
 		$defaults = self::get_default_opts();
348 348
 		foreach ( $defaults as $var => $default ) {
349 349
 			if ( is_array( $default ) ) {
350
-				if ( ! isset( $values[ $var ] ) ) {
351
-					$values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array();
350
+				if ( ! isset( $values[$var] ) ) {
351
+					$values[$var] = ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : array();
352 352
 				}
353 353
 
354 354
 				foreach ( $default as $k => $v ) {
355
-					$values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v );
355
+					$values[$var][$k] = ( $post_values && isset( $post_values[$var][$k] ) ) ? $post_values[$var][$k] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ) ? $record->options[$var][$k] : $v );
356 356
 
357 357
 					if ( is_array( $v ) ) {
358 358
 						foreach ( $v as $k1 => $v1 ) {
359
-							$values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 );
359
+							$values[$var][$k][$k1] = ( $post_values && isset( $post_values[$var][$k][$k1] ) ) ? $post_values[$var][$k][$k1] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ) ? $record->options[$var][$k][$k1] : $v1 );
360 360
 							unset( $k1, $v1 );
361 361
 						}
362 362
 					}
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 					unset( $k, $v );
365 365
 				}
366 366
 			} else {
367
-				$values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default );
367
+				$values[$var] = ( $post_values && isset( $post_values['options'][$var] ) ) ? $post_values['options'][$var] : ( ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : $default );
368 368
 			}
369 369
 
370 370
 			unset( $var, $default );
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	public static function fill_form_options( &$options, $values ) {
411 411
 		$defaults = self::get_default_opts();
412 412
 		foreach ( $defaults as $var => $default ) {
413
-			$options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default;
413
+			$options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default;
414 414
 			unset( $var, $default );
415 415
 		}
416 416
 	}
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 	public static function insert_opt_html( $args ) {
586 586
 		$class  = isset( $args['class'] ) ? $args['class'] : '';
587 587
 		$fields = FrmField::all_field_selection();
588
-		$field  = isset( $fields[ $args['type'] ] ) ? $fields[ $args['type'] ] : array();
588
+		$field  = isset( $fields[$args['type']] ) ? $fields[$args['type']] : array();
589 589
 
590 590
 		self::prepare_field_type( $field );
591 591
 
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 			FrmField::update( $field->id, array( 'field_order' => $field->field_order + 2 ) );
742 742
 		}
743 743
 
744
-		$add_order    += 2;
744
+		$add_order += 2;
745 745
 		$open         = false;
746 746
 		$reset_fields = true;
747 747
 	}
@@ -1148,10 +1148,10 @@  discard block
 block discarded – undo
1148 1148
 				$link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"';
1149 1149
 			}
1150 1150
 
1151
-			$label = ( isset( $link_details[ $length ] ) ? $link_details[ $length ] : $link_details['label'] );
1152
-			if ( $length == 'icon' && isset( $link_details[ $length ] ) ) {
1151
+			$label = ( isset( $link_details[$length] ) ? $link_details[$length] : $link_details['label'] );
1152
+			if ( $length == 'icon' && isset( $link_details[$length] ) ) {
1153 1153
 				$label = '<span class="' . $label . '" title="' . esc_attr( $link_details['label'] ) . '" aria-hidden="true"></span>';
1154
-				$link  .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"';
1154
+				$link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"';
1155 1155
 			}
1156 1156
 
1157 1157
 			$link .= '>' . $label . '</a>';
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
 			$status = 'publish';
1297 1297
 		}
1298 1298
 
1299
-		$name = $nice_names[ $status ];
1299
+		$name = $nice_names[$status];
1300 1300
 
1301 1301
 		return $name;
1302 1302
 	}
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
 		$icon = $icons[''];
1361 1361
 		if ( count( $categories ) === 1 ) {
1362 1362
 			$category = reset( $categories );
1363
-			$icon     = isset( $icons[ $category ] ) ? $icons[ $category ] : $icon;
1363
+			$icon     = isset( $icons[$category] ) ? $icons[$category] : $icon;
1364 1364
 		} elseif ( ! empty( $categories ) ) {
1365 1365
 			$icons = array_intersect_key( $icons, array_flip( $categories ) );
1366 1366
 			$icon = reset( $icons );
@@ -1498,7 +1498,7 @@  discard block
 block discarded – undo
1498 1498
 
1499 1499
 		foreach ( $item['categories'] as $k => $category ) {
1500 1500
 			if ( in_array( $category, $plans, true ) ) {
1501
-				unset( $item['categories'][ $k ] );
1501
+				unset( $item['categories'][$k] );
1502 1502
 
1503 1503
 				if ( in_array( $category, array( 'Creator', 'Personal' ), true ) ) {
1504 1504
 					// Show the current package name.
@@ -1700,9 +1700,9 @@  discard block
 block discarded – undo
1700 1700
 		}
1701 1701
 
1702 1702
 		foreach ( $shortcodes[0] as $key => $shortcode ) {
1703
-			$options = trim( $shortcodes[3][ $key ] );
1703
+			$options = trim( $shortcodes[3][$key] );
1704 1704
 
1705
-			if ( in_array( $shortcodes[1][ $key ], array( 'if ' ), true ) ) {
1705
+			if ( in_array( $shortcodes[1][$key], array( 'if ' ), true ) ) {
1706 1706
 				// Skip if shortcodes.
1707 1707
 				continue;
1708 1708
 			}
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
 				continue;
1713 1713
 			}
1714 1714
 
1715
-			$new_shortcode = '[' . $shortcodes[2][ $key ];
1715
+			$new_shortcode = '[' . $shortcodes[2][$key];
1716 1716
 			if ( $options ) {
1717 1717
 				$new_shortcode .= ' ' . $options;
1718 1718
 			}
Please login to merge, or discard this patch.
classes/controllers/FrmFormTemplatesController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 
330 330
 		// Perform add or remove operation.
331 331
 		if ( 'add' === $operation ) {
332
-			self::$favorite_templates[ $key ][] = $template_id;
332
+			self::$favorite_templates[$key][] = $template_id;
333 333
 		} elseif ( 'remove' === $operation ) {
334
-			$position = array_search( $template_id, self::$favorite_templates[ $key ], true );
334
+			$position = array_search( $template_id, self::$favorite_templates[$key], true );
335 335
 			if ( $position !== false ) {
336
-				unset( self::$favorite_templates[ $key ][ $position ] );
336
+				unset( self::$favorite_templates[$key][$position] );
337 337
 			}
338 338
 		}
339 339
 
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 		foreach ( self::$templates as $key => &$template ) {
463 463
 			// Skip the template if the categories are not set.
464 464
 			if ( ! isset( $template['categories'] ) ) {
465
-				unset( self::$templates[ $key ] );
465
+				unset( self::$templates[$key] );
466 466
 				continue;
467 467
 			}
468 468
 
@@ -476,14 +476,14 @@  discard block
 block discarded – undo
476 476
 				// Add the slug to the new array.
477 477
 				$template['category_slugs'][] = $category_slug;
478 478
 
479
-				if ( ! isset( self::$categories[ $category_slug ] ) ) {
480
-					self::$categories[ $category_slug ] = array(
479
+				if ( ! isset( self::$categories[$category_slug] ) ) {
480
+					self::$categories[$category_slug] = array(
481 481
 						'name'  => $category,
482 482
 						'count' => 0,
483 483
 					);
484 484
 				}
485 485
 
486
-				self::$categories[ $category_slug ]['count']++;
486
+				self::$categories[$category_slug]['count'] ++;
487 487
 			}
488 488
 
489 489
 			// Mark the template as favorite if it's in the favorite templates list.
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 		$redundant_cats = array_merge( array( 'PayPal', 'Stripe', 'Twilio' ), FrmFormsHelper::ignore_template_categories() );
497 497
 		foreach ( $redundant_cats as $redundant_cat ) {
498 498
 			$category_slug = sanitize_title( $redundant_cat );
499
-			unset( self::$categories[ $category_slug ] );
499
+			unset( self::$categories[$category_slug] );
500 500
 		}
501 501
 
502 502
 		// Sort the categories by keys alphabetically.
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 				'count' => 0, // Assigned via JavaScript.
521 521
 			);
522 522
 		}
523
-		$special_categories['all-templates']  = array(
523
+		$special_categories['all-templates'] = array(
524 524
 			'name'  => __( 'All Templates', 'formidable' ),
525 525
 			'count' => count( self::$templates ),
526 526
 		);
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
 	 */
548 548
 	private static function assign_featured_templates() {
549 549
 		foreach ( self::FEATURED_TEMPLATES_KEYS as $key ) {
550
-			if ( isset( self::$templates[ $key ] ) ) {
551
-				self::$templates[ $key ]['is_featured'] = true;
552
-				self::$featured_templates[]             = self::$templates[ $key ];
550
+			if ( isset( self::$templates[$key] ) ) {
551
+				self::$templates[$key]['is_featured'] = true;
552
+				self::$featured_templates[]             = self::$templates[$key];
553 553
 			}
554 554
 		}
555 555
 	}
Please login to merge, or discard this patch.