Completed
Pull Request — master (#2482)
by
unknown
45s
created
classes/helpers/FrmStylesHelper.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 				'-' => 'down',
144 144
 				'+' => 'up',
145 145
 			);
146
-			$class = 'frm_arrow' . $arrow[ $icon ];
146
+			$class = 'frm_arrow' . $arrow[$icon];
147 147
 		} else {
148 148
 			// frm_minus1_icon.
149 149
 			$key   = str_replace( 'p', '', $key );
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 				'-' => 'minus',
152 152
 				'+' => 'plus',
153 153
 			);
154
-			$class = 'frm_' . $plus[ $icon ];
154
+			$class = 'frm_' . $plus[$icon];
155 155
 		}
156 156
 
157 157
 		if ( $key ) {
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 		?>
178 178
 		<div class="btn-group" id="frm_<?php echo esc_attr( $name ); ?>_select">
179 179
 			<button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button">
180
-				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ); ?>
181
-				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ); ?>
180
+				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '+', $type ) ); ?>
181
+				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '-', $type ) ); ?>
182 182
 				<b class="caret"></b>
183 183
 			</button>
184 184
 			<ul class="multiselect-container frm-dropdown-menu">
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 					<li <?php echo $style->post_content['collapse_icon'] == $key ? 'class="active"' : ''; ?>>
187 187
 						<a href="javascript:void(0);">
188 188
 							<label>
189
-								<input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[ $name ], $key ); ?> />
189
+								<input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[$name], $key ); ?> />
190 190
 								<span>
191 191
 									<?php
192 192
 									FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '+', $type ) );
@@ -437,11 +437,11 @@  discard block
 block discarded – undo
437 437
 		$vars   = array_diff( $vars, $remove );
438 438
 
439 439
 		foreach ( $vars as $var ) {
440
-			if ( ! isset( $settings[ $var ] ) || ! self::css_key_is_valid( $var ) ) {
440
+			if ( ! isset( $settings[$var] ) || ! self::css_key_is_valid( $var ) ) {
441 441
 				continue;
442 442
 			}
443
-			if ( ! isset( $defaults[ $var ] ) ) {
444
-				$defaults[ $var ] = '';
443
+			if ( ! isset( $defaults[$var] ) ) {
444
+				$defaults[$var] = '';
445 445
 			}
446 446
 
447 447
 			$prepared_value = '';
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 			return false;
467 467
 		}
468 468
 
469
-		if ( $defaults && $defaults[ $var ] === $prepared_value ) {
469
+		if ( $defaults && $defaults[$var] === $prepared_value ) {
470 470
 			return false;
471 471
 		}
472 472
 
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	 * @return string
548 548
 	 */
549 549
 	private static function css_var_prepare_value( $settings, $key ) {
550
-		$value = $settings[ $key ];
550
+		$value = $settings[$key];
551 551
 
552 552
 		switch ( $key ) {
553 553
 			case 'font':
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 				break;
580 580
 		}//end switch
581 581
 
582
-		return esc_html( $settings[ $key ] );
582
+		return esc_html( $settings[$key] );
583 583
 	}
584 584
 
585 585
 	/**
@@ -628,8 +628,8 @@  discard block
 block discarded – undo
628 628
 
629 629
 		$checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' );
630 630
 		foreach ( $checkbox_opts as $opt ) {
631
-			if ( ! isset( $settings[ $opt ] ) ) {
632
-				$settings[ $opt ] = 0;
631
+			if ( ! isset( $settings[$opt] ) ) {
632
+				$settings[$opt] = 0;
633 633
 			}
634 634
 		}
635 635
 
@@ -677,9 +677,9 @@  discard block
 block discarded – undo
677 677
 		);
678 678
 
679 679
 		array_map(
680
-			function ( $key ) use ( $defaults, $font_size, $base_font_size, &$settings ) {
681
-				if ( isset( $settings[ $key ] ) ) {
682
-					$settings[ $key ] = round( self::get_base_font_size_scale( $key, $font_size, $defaults ) * $base_font_size ) . 'px';
680
+			function( $key ) use ( $defaults, $font_size, $base_font_size, &$settings ) {
681
+				if ( isset( $settings[$key] ) ) {
682
+					$settings[$key] = round( self::get_base_font_size_scale( $key, $font_size, $defaults ) * $base_font_size ) . 'px';
683 683
 				}
684 684
 			},
685 685
 			$font_sizes_to_update
@@ -696,11 +696,11 @@  discard block
 block discarded – undo
696 696
 	 * @return float
697 697
 	 */
698 698
 	private static function get_base_font_size_scale( $key, $value, $defaults ) {
699
-		if ( empty( $defaults[ $key ] ) || ! is_numeric( (int) $defaults[ $key ] ) || ! is_numeric( (int) $value ) || 0 === (int) $value ) {
699
+		if ( empty( $defaults[$key] ) || ! is_numeric( (int) $defaults[$key] ) || ! is_numeric( (int) $value ) || 0 === (int) $value ) {
700 700
 			return 1;
701 701
 		}
702 702
 
703
-		return round( (int) $defaults[ $key ] / (int) $value, 2 );
703
+		return round( (int) $defaults[$key] / (int) $value, 2 );
704 704
 	}
705 705
 
706 706
 	/**
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 				$css = '';
714 714
 			}
715 715
 			foreach ( $opts as $opt ) {
716
-				self::get_color_output( $css, $settings[ $opt ] );
716
+				self::get_color_output( $css, $settings[$opt] );
717 717
 			}
718 718
 		}
719 719
 	}
@@ -926,13 +926,13 @@  discard block
 block discarded – undo
926 926
 	 */
927 927
 	private static function get_default_style_count( $style_id, $conversational_style_id ) {
928 928
 		$substrings = array_map(
929
-			function ( $value ) {
929
+			function( $value ) {
930 930
 				$substring = serialize( array( 'custom_style' => $value ) );
931 931
 				return substr( $substring, 5, -1 );
932 932
 			},
933 933
 			array( '1', 1 )
934 934
 		);
935
-		$where      = array(
935
+		$where = array(
936 936
 			'status' => 'published',
937 937
 			0        => array(
938 938
 				'options NOT LIKE' => 'custom_style',
Please login to merge, or discard this patch.