Completed
Pull Request — master (#1356)
by Stephanie
32s
created
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.
stripe/models/FrmTransLitePayment.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,11 +126,11 @@
 block discarded – undo
126 126
 		foreach ( $payments as $payment ) {
127 127
 			list( $amount, $currency ) = FrmTransLiteAppHelper::get_amount_and_currency_from_payment( $payment );
128 128
 
129
-			if ( ! isset( $data[ $currency ] ) ) {
130
-				$data[ $currency ] = 0;
129
+			if ( ! isset( $data[$currency] ) ) {
130
+				$data[$currency] = 0;
131 131
 			}
132 132
 
133
-			$data[ $currency ] += floatval( $amount );
133
+			$data[$currency] += floatval( $amount );
134 134
 		}
135 135
 
136 136
 		return $data;
Please login to merge, or discard this patch.
classes/helpers/FrmEmailSummaryHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	public static function get_last_sent_date( $type ) {
238 238
 		$options = self::get_options();
239
-		if ( empty( $options[ 'last_' . $type ] ) ) {
239
+		if ( empty( $options['last_' . $type] ) ) {
240 240
 			return false;
241 241
 		}
242 242
 
243
-		return $options[ 'last_' . $type ];
243
+		return $options['last_' . $type];
244 244
 	}
245 245
 
246 246
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	public static function set_last_sent_date( $type, $value = null ) {
253 253
 		$options = self::get_options();
254 254
 
255
-		$options[ 'last_' . $type ] = null === $value ? self::get_date_from_today() : '';
255
+		$options['last_' . $type] = null === $value ? self::get_date_from_today() : '';
256 256
 		self::save_options( $options );
257 257
 	}
258 258
 
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' => self::get_template_count(),
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.
classes/controllers/FrmDashboardController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -379,12 +379,12 @@  discard block
 block discarded – undo
379 379
 		if ( $form_id ) {
380 380
 			self::get_columns_for_form( $form_id, $columns );
381 381
 		} else {
382
-			$columns[ $form_id . '_form_id' ] = esc_html__( 'Form', 'formidable' );
383
-			$columns[ $form_id . '_name' ]    = esc_html__( 'Name', 'formidable' );
384
-			$columns[ $form_id . '_user_id' ] = esc_html__( 'Author', 'formidable' );
382
+			$columns[$form_id . '_form_id'] = esc_html__( 'Form', 'formidable' );
383
+			$columns[$form_id . '_name']    = esc_html__( 'Name', 'formidable' );
384
+			$columns[$form_id . '_user_id'] = esc_html__( 'Author', 'formidable' );
385 385
 		}
386 386
 
387
-		$columns[ $form_id . '_created_at' ] = esc_html__( 'Created on', 'formidable' );
387
+		$columns[$form_id . '_created_at'] = esc_html__( 'Created on', 'formidable' );
388 388
 
389 389
 		return $columns;
390 390
 	}
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 	 * @return boolean
396 396
 	 */
397 397
 	public static function welcome_banner_has_closed() {
398
-		if ( isset( $_COOKIE[ self::$banner_closed_cookie_name ] ) ) {
399
-			list( $cookie_value, $expiration_time ) = explode( '|', sanitize_text_field( wp_unslash( $_COOKIE[ self::$banner_closed_cookie_name ] ) ) );
398
+		if ( isset( $_COOKIE[self::$banner_closed_cookie_name] ) ) {
399
+			list( $cookie_value, $expiration_time ) = explode( '|', sanitize_text_field( wp_unslash( $_COOKIE[self::$banner_closed_cookie_name] ) ) );
400 400
 			if ( 1 === (int) $cookie_value ) {
401 401
 				// Refresh welcome banner cookie if it will expire in less 45 days.
402 402
 				if ( (int) $expiration_time < time() + ( 45 * 24 * 60 * 60 ) ) {
Please login to merge, or discard this patch.