Completed
Pull Request — master (#2576)
by
unknown
40s
created
classes/controllers/FrmAddonsController.php 1 patch
Spacing   +26 added lines, -28 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
classes/controllers/FrmAppController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1334,11 +1334,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'] ) ) {
Please login to merge, or discard this patch.
classes/views/addons/min-version-notice.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,10 @@
 block discarded – undo
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>
Please login to merge, or discard this patch.
classes/controllers/FrmWelcomeTourController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.