Completed
Pull Request — master (#1580)
by Stephanie
57s
created
classes/helpers/FrmOnboardingWizardHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
 			'secondary-button-role'      => 'button',
101 101
 			'secondary-button-skip-step' => true,
102 102
 		);
103
-		$args     = wp_parse_args( $args, $defaults );
103
+		$args = wp_parse_args( $args, $defaults );
104 104
 
105 105
 		// Set the primary button attributes.
106 106
 		$primary_button_attributes          = array(
Please login to merge, or discard this patch.
classes/models/FrmEntryValues.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
 	 * @return array
182 182
 	 */
183 183
 	private function prepare_array_property( $index, $atts ) {
184
-		if ( isset( $atts[ $index ] ) && ! empty( $atts[ $index ] ) ) {
184
+		if ( isset( $atts[$index] ) && ! empty( $atts[$index] ) ) {
185 185
 
186
-			if ( is_array( $atts[ $index ] ) ) {
187
-				$property = $atts[ $index ];
186
+			if ( is_array( $atts[$index] ) ) {
187
+				$property = $atts[$index];
188 188
 			} else {
189
-				$property = explode( ',', $atts[ $index ] );
189
+				$property = explode( ',', $atts[$index] );
190 190
 			}
191 191
 		} else {
192 192
 			$property = array();
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 			);
267 267
 		}
268 268
 
269
-		$ip       = array(
269
+		$ip = array(
270 270
 			'label' => __( 'IP Address', 'formidable' ),
271 271
 			'value' => $this->entry->ip,
272 272
 		);
273
-		$browser  = array(
273
+		$browser = array(
274 274
 			'label' => __( 'User-Agent (Browser/OS)', 'formidable' ),
275 275
 			'value' => isset( $entry_description['browser'] ) ? FrmEntriesHelper::get_browser( $entry_description['browser'] ) : '',
276 276
 		);
@@ -357,6 +357,6 @@  discard block
 block discarded – undo
357 357
 	 * @return void
358 358
 	 */
359 359
 	protected function add_field_values( $field ) {
360
-		$this->field_values[ $field->id ] = new FrmFieldValue( $field, $this->entry );
360
+		$this->field_values[$field->id] = new FrmFieldValue( $field, $this->entry );
361 361
 	}
362 362
 }
Please login to merge, or discard this patch.
classes/models/FrmDb.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 		);
315 315
 
316 316
 		$where_is = strtolower( $where_is );
317
-		if ( isset( $switch_to[ $where_is ] ) ) {
318
-			return ' ' . $switch_to[ $where_is ];
317
+		if ( isset( $switch_to[$where_is] ) ) {
318
+			return ' ' . $switch_to[$where_is];
319 319
 		}
320 320
 
321 321
 		// > and < need a little more work since we don't want them switched to >= and <=
@@ -380,13 +380,13 @@  discard block
 block discarded – undo
380 380
 		$temp_args = $args;
381 381
 		foreach ( $temp_args as $k => $v ) {
382 382
 			if ( $v == '' ) {
383
-				unset( $args[ $k ] );
383
+				unset( $args[$k] );
384 384
 				continue;
385 385
 			}
386 386
 
387 387
 			$db_name = strtoupper( str_replace( '_', ' ', $k ) );
388 388
 			if ( strpos( $v, $db_name ) === false ) {
389
-				$args[ $k ] = $db_name . ' ' . $v;
389
+				$args[$k] = $db_name . ' ' . $v;
390 390
 			}
391 391
 		}
392 392
 
@@ -460,13 +460,13 @@  discard block
 block discarded – undo
460 460
 	private static function esc_query_args( &$args ) {
461 461
 		foreach ( $args as $param => $value ) {
462 462
 			if ( $param == 'order_by' ) {
463
-				$args[ $param ] = self::esc_order( $value );
463
+				$args[$param] = self::esc_order( $value );
464 464
 			} elseif ( $param == 'limit' ) {
465
-				$args[ $param ] = self::esc_limit( $value );
465
+				$args[$param] = self::esc_limit( $value );
466 466
 			}
467 467
 
468
-			if ( $args[ $param ] == '' ) {
469
-				unset( $args[ $param ] );
468
+			if ( $args[$param] == '' ) {
469
+				unset( $args[$param] );
470 470
 			}
471 471
 		}
472 472
 	}
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 		$limit = explode( ',', trim( $limit ) );
550 550
 		foreach ( $limit as $k => $l ) {
551 551
 			if ( is_numeric( $l ) ) {
552
-				$limit[ $k ] = $l;
552
+				$limit[$k] = $l;
553 553
 			}
554 554
 		}
555 555
 
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	 */
703 703
 	public static function add_key_to_group_cache( $key, $group ) {
704 704
 		$cached         = self::get_group_cached_keys( $group );
705
-		$cached[ $key ] = $key;
705
+		$cached[$key] = $key;
706 706
 		wp_cache_set( 'cached_keys', $cached, $group, 300 );
707 707
 	}
708 708
 
Please login to merge, or discard this patch.
classes/models/FrmEmailStats.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 		// Build total for each currency.
151 151
 		foreach ( $payment_data['total'] as $currency => $amount ) {
152
-			$stats[ 'payments_total_' . $currency ] = array(
152
+			$stats['payments_total_' . $currency] = array(
153 153
 				// translators: currency name.
154 154
 				'label'   => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ),
155 155
 				'count'   => $amount,
@@ -171,23 +171,23 @@  discard block
 block discarded – undo
171 171
 
172 172
 			// Compare total for each currency.
173 173
 			foreach ( $payment_data['total'] as $currency => $amount ) {
174
-				if ( ! isset( $prev_payment_data['total'][ $currency ] ) ) {
175
-					$stats[ 'payments_total_' . $currency ]['compare'] = 1;
174
+				if ( ! isset( $prev_payment_data['total'][$currency] ) ) {
175
+					$stats['payments_total_' . $currency]['compare'] = 1;
176 176
 					continue;
177 177
 				}
178 178
 
179
-				$stats[ 'payments_total_' . $currency ]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][ $currency ] );
180
-				unset( $prev_payment_data['total'][ $currency ] );
179
+				$stats['payments_total_' . $currency]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][$currency] );
180
+				unset( $prev_payment_data['total'][$currency] );
181 181
 			}
182 182
 
183 183
 			// If prev month has more currencies.
184 184
 			foreach ( $prev_payment_data['total'] as $currency => $amount ) {
185
-				$stats[ 'payments_total_' . $currency ] = array(
185
+				$stats['payments_total_' . $currency] = array(
186 186
 					// translators: currency name.
187 187
 					'label'   => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ),
188 188
 					'count'   => 0,
189 189
 					'display' => $this->get_formatted_price( 0, $currency ),
190
-					'compare' => -1,
190
+					'compare' => - 1,
191 191
 				);
192 192
 			}
193 193
 		}//end if
Please login to merge, or discard this patch.
classes/models/FrmFieldFormHtml.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param array  $atts
45 45
 	 */
46 46
 	private function _set( $param, $atts ) {
47
-		if ( isset( $atts[ $param ] ) ) {
48
-			$this->{$param} = $atts[ $param ];
47
+		if ( isset( $atts[$param] ) ) {
48
+			$this->{$param} = $atts[$param];
49 49
 		}
50 50
 	}
51 51
 
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 
90 90
 		$exclude = array( 'field_obj', 'html' );
91 91
 		foreach ( $exclude as $ex ) {
92
-			if ( isset( $atts[ $ex ] ) ) {
93
-				unset( $this->pass_args[ $ex ] );
92
+			if ( isset( $atts[$ex] ) ) {
93
+				unset( $this->pass_args[$ex] );
94 94
 			}
95 95
 		}
96 96
 	}
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 * @param array $set
103 103
 	 */
104 104
 	private function set_from_field( $atts, $set ) {
105
-		if ( isset( $atts[ $set['param'] ] ) ) {
106
-			$this->{$set['param']} = $atts[ $set['param'] ];
105
+		if ( isset( $atts[$set['param']] ) ) {
106
+			$this->{$set['param']} = $atts[$set['param']];
107 107
 		} else {
108 108
 			$this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] );
109 109
 		}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	private function replace_error_shortcode() {
232 232
 		$this->maybe_add_error_id();
233
-		$error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false;
233
+		$error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false;
234 234
 
235 235
 		if ( ! empty( $error ) && false === strpos( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) {
236 236
 			$error_body = self::get_error_body( $this->html );
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @since 3.06.02
272 272
 	 */
273 273
 	private function maybe_add_error_id() {
274
-		if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) {
274
+		if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) {
275 275
 			return;
276 276
 		}
277 277
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER );
352 352
 
353 353
 		foreach ( $shortcodes[0] as $short_key => $tag ) {
354
-			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
354
+			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
355 355
 			$tag            = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key );
356 356
 
357 357
 			$replace_with = '';
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 				$replace_with = $this->replace_input_shortcode( $shortcode_atts );
363 363
 			}
364 364
 
365
-			$this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html );
365
+			$this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html );
366 366
 		}
367 367
 	}
368 368
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	 */
385 385
 	private function prepare_input_shortcode_atts( $shortcode_atts ) {
386 386
 		if ( isset( $shortcode_atts['opt'] ) ) {
387
-			--$shortcode_atts['opt'];
387
+			-- $shortcode_atts['opt'];
388 388
 		}
389 389
 
390 390
 		$field_class = isset( $shortcode_atts['class'] ) ? $shortcode_atts['class'] : '';
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 			unset( $shortcode_atts['class'] );
395 395
 		}
396 396
 
397
-		$shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false';
397
+		$shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? 'true' : 'false';
398 398
 
399 399
 		$this->field_obj->set_field_column( 'shortcodes', $shortcode_atts );
400 400
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 	 */
447 447
 	private function get_field_div_classes() {
448 448
 		// Add error class
449
-		$classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : '';
449
+		$classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : '';
450 450
 
451 451
 		// Add label position class
452 452
 		$settings = $this->field_obj->display_field_settings();
Please login to merge, or discard this patch.
classes/models/FrmUsage.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 		foreach ( $pass_settings as $setting ) {
146 146
 			if ( isset( $settings_list->$setting ) ) {
147
-				$settings[ $setting ] = $this->maybe_json( $settings_list->$setting );
147
+				$settings[$setting] = $this->maybe_json( $settings_list->$setting );
148 148
 			}
149 149
 		}
150 150
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
 		$message_settings = array();
180 180
 		foreach ( $messages as $message ) {
181
-			$message_settings[ $message ] = $settings_list->$message;
181
+			$message_settings[$message] = $settings_list->$message;
182 182
 		}
183 183
 
184 184
 		return $message_settings;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
 		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
200 200
 			if ( isset( $settings_list->$frm_role ) ) {
201
-				$permissions[ $frm_role ] = $settings_list->$frm_role;
201
+				$permissions[$frm_role] = $settings_list->$frm_role;
202 202
 			}
203 203
 		}
204 204
 
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
 			);
269 269
 
270 270
 			foreach ( $settings as $setting ) {
271
-				if ( isset( $form->options[ $setting ] ) ) {
272
-					$new_form[ $setting ] = $this->maybe_json( $form->options[ $setting ] );
271
+				if ( isset( $form->options[$setting] ) ) {
272
+					$new_form[$setting] = $this->maybe_json( $form->options[$setting] );
273 273
 				}
274 274
 			}
275 275
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		$fields = FrmDb::get_results( 'frm_fields', array(), 'form_id, name, type, field_options', $args );
329 329
 		foreach ( $fields as $k => $field ) {
330 330
 			FrmAppHelper::unserialize_or_decode( $field->field_options );
331
-			$fields[ $k ]->field_options = json_encode( $field->field_options );
331
+			$fields[$k]->field_options = json_encode( $field->field_options );
332 332
 		}
333 333
 		return $fields;
334 334
 	}
Please login to merge, or discard this patch.
classes/models/FrmPluginSearch.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
 			'name'              => sprintf(
81 81
 				/* translators: Formidable addon name */
82 82
 				esc_html_x( 'Formidable %s', 'Formidable Addon Name', 'formidable' ),
83
-				$addon_list[ $matching_addon ]['name']
83
+				$addon_list[$matching_addon]['name']
84 84
 			),
85
-			'addon'             => $addon_list[ $matching_addon ]['slug'],
86
-			'short_description' => $addon_list[ $matching_addon ]['excerpt'],
85
+			'addon'             => $addon_list[$matching_addon]['slug'],
86
+			'short_description' => $addon_list[$matching_addon]['excerpt'],
87 87
 			'slug'              => self::$slug,
88
-			'version'           => $addon_list[ $matching_addon ]['version'],
88
+			'version'           => $addon_list[$matching_addon]['version'],
89 89
 		);
90 90
 
91
-		if ( ! empty( $addon_list[ $matching_addon ]['external'] ) ) {
91
+		if ( ! empty( $addon_list[$matching_addon]['external'] ) ) {
92 92
 			unset( $overrides['name'] );
93 93
 		}
94 94
 
95 95
 		// Splice in the base addon data.
96
-		$inject = array_merge( $inject, $addon_list[ $matching_addon ], $overrides );
96
+		$inject = array_merge( $inject, $addon_list[$matching_addon], $overrides );
97 97
 
98 98
 		// Add it to the top of the list.
99 99
 		array_unshift( $result->plugins, $inject );
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 		// Plugin installed, active, feature not enabled; prompt to enable.
309 309
 		if ( ! $is_active && $is_installed ) {
310 310
 			if ( current_user_can( 'activate_plugins' ) ) {
311
-				$activate_url             = add_query_arg(
311
+				$activate_url = add_query_arg(
312 312
 					array(
313 313
 						'action'   => 'activate',
314 314
 						'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin['plugin'] ),
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 */
353 353
 	protected function is_installed( $plugin ) {
354 354
 		$all_plugins = FrmAppHelper::get_plugins();
355
-		return isset( $all_plugins[ $plugin ] );
355
+		return isset( $all_plugins[$plugin] );
356 356
 	}
357 357
 
358 358
 	/**
Please login to merge, or discard this patch.
classes/models/FrmFormMigrator.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 
235 235
 			// This may occassionally skip one level/order e.g. after adding a
236 236
 			// list field, as field_order would already be prepared to be used.
237
-			++$field_order;
237
+			++ $field_order;
238 238
 
239 239
 			if ( isset( $new_field['fields'] ) && is_array( $new_field['fields'] ) && ! empty( $new_field['fields'] ) ) {
240 240
 				// we have (inner) fields to merge
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
 		$order = 0;
274 274
 		foreach ( $fields as $field ) {
275
-			++$order;
275
+			++ $order;
276 276
 			$type     = $this->get_field_type( $field );
277 277
 			$new_type = $this->convert_field_type( $type, $field );
278 278
 			if ( ! in_array( $new_type, $with_end ) && $new_type !== 'break' ) {
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		$sub['name'] = __( 'Section Buttons', 'formidable' );
303 303
 		$subs        = array( $sub );
304 304
 		$this->insert_fields_in_array( $subs, $order, 0, $fields );
305
-		++$order;
305
+		++ $order;
306 306
 	}
307 307
 
308 308
 	/**
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	protected function create_fields( $form_id, &$form ) {
400 400
 		foreach ( $form['fields'] as $key => $new_field ) {
401 401
 			$new_field['form_id']         = $form_id;
402
-			$form['fields'][ $key ]['id'] = FrmField::create( $new_field );
402
+			$form['fields'][$key]['id'] = FrmField::create( $new_field );
403 403
 		}
404 404
 	}
405 405
 
@@ -433,9 +433,9 @@  discard block
 block discarded – undo
433 433
 			} elseif ( $key === 'the_post_title' ) {
434 434
 				$new_action->post_content['post_title'] = $value;
435 435
 			} elseif ( is_string( $value ) ) {
436
-				$new_action->post_content[ $key ] = $this->replace_smart_tags( $value, $form['fields'] );
436
+				$new_action->post_content[$key] = $this->replace_smart_tags( $value, $form['fields'] );
437 437
 			} else {
438
-				$new_action->post_content[ $key ] = $value;
438
+				$new_action->post_content[$key] = $value;
439 439
 			}
440 440
 		}
441 441
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 
455 455
 		$imported = $this->get_tracked_import();
456 456
 
457
-		$imported[ $this->slug ][ $new_form_id ] = $source_id;
457
+		$imported[$this->slug][$new_form_id] = $source_id;
458 458
 
459 459
 		update_option( $this->tracking, $imported, false );
460 460
 	}
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 	private function is_imported( $source_id ) {
475 475
 		$imported    = $this->get_tracked_import();
476 476
 		$new_form_id = 0;
477
-		if ( ! isset( $imported[ $this->slug ] ) || ! in_array( $source_id, $imported[ $this->slug ] ) ) {
477
+		if ( ! isset( $imported[$this->slug] ) || ! in_array( $source_id, $imported[$this->slug] ) ) {
478 478
 			return $new_form_id;
479 479
 		}
480 480
 
481
-		$new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) );
481
+		$new_form_id = array_search( $source_id, array_reverse( $imported[$this->slug], true ) );
482 482
 		if ( ! empty( $new_form_id ) && empty( FrmForm::get_key_by_id( $new_form_id ) ) ) {
483 483
 			// Allow reimport if the form was deleted.
484 484
 			$new_form_id = 0;
Please login to merge, or discard this patch.
classes/models/FrmFormTemplateApi.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
 		$templates    = $this->get_api_info();
96 96
 		$contact_form = 20872734;
97
-		return isset( $templates[ $contact_form ] ) && ! empty( $templates[ $contact_form ]['url'] );
97
+		return isset( $templates[$contact_form] ) && ! empty( $templates[$contact_form]['url'] );
98 98
 	}
99 99
 
100 100
 	/**
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
 					continue;
170 170
 				}
171 171
 
172
-				$data['urlByKey'][ $template['key'] ] = $template['url'];
172
+				$data['urlByKey'][$template['key']] = $template['url'];
173 173
 			}
174 174
 
175
-			if ( ! isset( $data['urlByKey'][ $key ] ) ) {
175
+			if ( ! isset( $data['urlByKey'][$key] ) ) {
176 176
 				$error = new WP_Error( 400, 'We were unable to retrieve the template' );
177 177
 				wp_send_json_error( $error );
178 178
 			}
179 179
 
180
-			$data['url'] = $data['urlByKey'][ $key ];
180
+			$data['url'] = $data['urlByKey'][$key];
181 181
 		}//end if
182 182
 
183 183
 		wp_send_json_success( $data );
Please login to merge, or discard this patch.