Completed
Pull Request — master (#1039)
by Stephanie
40s
created
classes/helpers/FrmStylesHelper.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -285,7 +285,8 @@
 block discarded – undo
285 285
 	public static function get_settings_for_output( $style ) {
286 286
 		if ( self::previewing_style() ) {
287 287
 			$frm_style = new FrmStyle();
288
-			if ( isset( $_POST['frm_style_setting'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
288
+			if ( isset( $_POST['frm_style_setting'] ) ) {
289
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
289 290
 
290 291
 				// Sanitizing is done later.
291 292
 				$posted = wp_unslash( $_POST['frm_style_setting'] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 				'-' => 'down',
136 136
 				'+' => 'up',
137 137
 			);
138
-			$class = 'frm_arrow' . $arrow[ $icon ];
138
+			$class = 'frm_arrow' . $arrow[$icon];
139 139
 		} else {
140 140
 			//frm_minus1_icon
141 141
 			$key   = str_replace( 'p', '', $key );
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 				'-' => 'minus',
144 144
 				'+' => 'plus',
145 145
 			);
146
-			$class = 'frm_' . $plus[ $icon ];
146
+			$class = 'frm_' . $plus[$icon];
147 147
 		}
148 148
 
149 149
 		if ( $key ) {
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 		?>
170 170
 		<div class="btn-group" id="frm_<?php echo esc_attr( $name ); ?>_select">
171 171
 			<button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button">
172
-				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ); ?>
173
-				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ); ?>
172
+				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '+', $type ) ); ?>
173
+				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '-', $type ) ); ?>
174 174
 				<b class="caret"></b>
175 175
 			</button>
176 176
 			<ul class="multiselect-container frm-dropdown-menu">
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 					<li <?php echo ( $style->post_content['collapse_icon'] == $key ) ? 'class="active"' : ''; ?>>
179 179
 						<a href="javascript:void(0);">
180 180
 							<label>
181
-								<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 ); ?> />
181
+								<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 ); ?> />
182 182
 								<span>
183 183
 									<?php
184 184
 									FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '+', $type ) );
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
 		$vars   = array_diff( $vars, $remove );
272 272
 
273 273
 		foreach ( $vars as $var ) {
274
-			if ( ! isset( $settings[ $var ] ) ) {
274
+			if ( ! isset( $settings[$var] ) ) {
275 275
 				continue;
276 276
 			}
277
-			if ( ! isset( $defaults[ $var ] ) ) {
278
-				$defaults[ $var ] = '';
277
+			if ( ! isset( $defaults[$var] ) ) {
278
+				$defaults[$var] = '';
279 279
 			}
280
-			$show = empty( $defaults ) || ( $settings[ $var ] !== '' && $settings[ $var ] !== $defaults[ $var ] );
280
+			$show = empty( $defaults ) || ( $settings[$var] !== '' && $settings[$var] !== $defaults[$var] );
281 281
 			if ( $show ) {
282
-				echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[ $var ] ) : esc_html( $settings[ $var ] ) ) . ';'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
282
+				echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[$var] ) : esc_html( $settings[$var] ) ) . ';'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
283 283
 			}
284 284
 		}
285 285
 	}
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 
329 329
 		$checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' );
330 330
 		foreach ( $checkbox_opts as $opt ) {
331
-			if ( ! isset( $settings[ $opt ] ) ) {
332
-				$settings[ $opt ] = 0;
331
+			if ( ! isset( $settings[$opt] ) ) {
332
+				$settings[$opt] = 0;
333 333
 			}
334 334
 		}
335 335
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 				$css = '';
358 358
 			}
359 359
 			foreach ( $opts as $opt ) {
360
-				self::get_color_output( $css, $settings[ $opt ] );
360
+				self::get_color_output( $css, $settings[$opt] );
361 361
 			}
362 362
 		}
363 363
 	}
Please login to merge, or discard this patch.
classes/helpers/FrmStylesPreviewHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@
 block discarded – undo
168 168
 			return;
169 169
 		}
170 170
 
171
-		unset( $dependencies[ $index ] );
171
+		unset( $dependencies[$index] );
172 172
 		$dependencies = array_values( $dependencies );
173 173
 
174 174
 		$styles->registered['wp-admin']->deps = $dependencies;
Please login to merge, or discard this patch.
classes/helpers/FrmStylesCardHelper.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -349,12 +349,12 @@
 block discarded – undo
349 349
 		array_walk(
350 350
 			$styles,
351 351
 			/**
352
-			* Echo a style card for a single style in the $styles array.
353
-			*
354
-			* @param WP_Post $style
355
-			* @param int     $count Used for pagination.
356
-			* @return void
357
-			*/
352
+			 * Echo a style card for a single style in the $styles array.
353
+			 *
354
+			 * @param WP_Post $style
355
+			 * @param int     $count Used for pagination.
356
+			 * @return void
357
+			 */
358 358
 			function( $style ) use ( &$count ) {
359 359
 				$hidden = $count > ( self::PAGE_SIZE - 1 );
360 360
 				$this->echo_style_card( $style, $hidden );
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 	private static function has_dark_background( $style ) {
131 131
 		$key = 'fieldset_bg_color';
132 132
 
133
-		if ( empty( $style->post_content[ $key ] ) ) {
133
+		if ( empty( $style->post_content[$key] ) ) {
134 134
 			return false;
135 135
 		}
136 136
 
137
-		$color = $style->post_content[ $key ];
137
+		$color = $style->post_content[$key];
138 138
 
139 139
 		if ( 0 === strpos( $color, 'rgba' ) ) {
140 140
 			preg_match_all( '/([\\d.]+)/', $color, $matches );
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 					),
205 205
 					'/style-templates/' . $style['slug']
206 206
 				);
207
-				$params['data-requires']    = FrmFormsHelper::get_plan_required( $style );
207
+				$params['data-requires'] = FrmFormsHelper::get_plan_required( $style );
208 208
 				return $params;
209 209
 			};
210 210
 		} else {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 				continue;
266 266
 			}
267 267
 
268
-			$value = $style->post_content[ $key ];
268
+			$value = $style->post_content[$key];
269 269
 
270 270
 			$is_hex = in_array( $key, $color_settings, true ) && $value && '#' !== $value[0] && false === strpos( $value, 'rgb' ) && $value !== 'transparent';
271 271
 			if ( $is_hex ) {
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 			function( $style ) use ( &$count ) {
414 414
 				$hidden = $count > ( self::PAGE_SIZE - 1 );
415 415
 				$this->echo_style_card( $style, $hidden );
416
-				++$count;
416
+				++ $count;
417 417
 			}
418 418
 		);
419 419
 
Please login to merge, or discard this patch.
classes/models/FrmStyleApi.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 		// Remove 'Styling Template' from titles.
51 51
 		foreach ( $api_info as $id => $template ) {
52 52
 			if ( isset( $template['name'] ) ) {
53
-				$api_info[ $id ]['name'] = preg_replace( '/(\sStyle|Styling)?(\sTemplate)?$/', '', $template['name'] );
53
+				$api_info[$id]['name'] = preg_replace( '/(\sStyle|Styling)?(\sTemplate)?$/', '', $template['name'] );
54 54
 			}
55 55
 		}
56 56
 
Please login to merge, or discard this patch.
classes/models/fields/FrmFieldType.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 		$field_val = '';
133 133
 		if ( is_object( $this->field ) ) {
134 134
 			$field_val = $this->field->{$column};
135
-		} elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) {
136
-			$field_val = $this->field[ $column ];
135
+		} elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) {
136
+			$field_val = $this->field[$column];
137 137
 		}
138 138
 
139 139
 		return $field_val;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		if ( is_object( $this->field ) ) {
148 148
 			$this->field->{$column} = $value;
149 149
 		} elseif ( is_array( $this->field ) ) {
150
-			$this->field[ $column ] = $value;
150
+			$this->field[$column] = $value;
151 151
 		}
152 152
 	}
153 153
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 			printf(
528 528
 				/* translators: %s: Field type */
529 529
 				esc_html__( '%s Options', 'formidable' ),
530
-				esc_html( $all_field_types[ $args['display']['type'] ]['name'] )
530
+				esc_html( $all_field_types[$args['display']['type']]['name'] )
531 531
 			);
532 532
 			FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) );
533 533
 			?>
@@ -650,8 +650,8 @@  discard block
 block discarded – undo
650 650
 		$fields = FrmField::field_selection();
651 651
 		$fields = array_merge( $fields, FrmField::pro_field_selection() );
652 652
 
653
-		if ( isset( $fields[ $this->type ] ) ) {
654
-			$name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ];
653
+		if ( isset( $fields[$this->type] ) ) {
654
+			$name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type];
655 655
 		}
656 656
 
657 657
 		return $name;
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 	}
663 663
 
664 664
 	public function get_default_field_options() {
665
-		$opts       = array(
665
+		$opts = array(
666 666
 			'size'               => '',
667 667
 			'max'                => '',
668 668
 			'label'              => '',
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 			}
1005 1005
 		} else {
1006 1006
 			$args['save_array'] = $this->is_readonly_array();
1007
-			$hidden             .= $this->show_single_hidden( $selected_value, $args );
1007
+			$hidden .= $this->show_single_hidden( $selected_value, $args );
1008 1008
 		}
1009 1009
 
1010 1010
 		return $hidden;
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
 	protected function show_single_hidden( $selected, $args ) {
1014 1014
 		if ( $args['save_array'] ) {
1015 1015
 			$args['field_name'] .= '[]';
1016
-			$id                 = '';
1016
+			$id = '';
1017 1017
 		} else {
1018 1018
 			$id = ' id="' . esc_attr( $args['html_id'] ) . '"';
1019 1019
 		}
@@ -1029,8 +1029,8 @@  discard block
 block discarded – undo
1029 1029
 		$selected = $values['field_value'];
1030 1030
 
1031 1031
 		if ( isset( $values['combo_name'] ) ) {
1032
-			$options  = $options[ $values['combo_name'] ];
1033
-			$selected = ( is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ) ? $selected[ $values['combo_name'] ] : '';
1032
+			$options  = $options[$values['combo_name']];
1033
+			$selected = ( is_array( $selected ) && isset( $selected[$values['combo_name']] ) ) ? $selected[$values['combo_name']] : '';
1034 1034
 		}
1035 1035
 
1036 1036
 		$input = $this->select_tag( $values );
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 	}
1082 1082
 
1083 1083
 	protected function fill_display_field_values( $args = array() ) {
1084
-		$defaults        = array(
1084
+		$defaults = array(
1085 1085
 			'field_name'    => 'item_meta[' . $this->get_field_column( 'id' ) . ']',
1086 1086
 			'field_id'      => $this->get_field_column( 'id' ),
1087 1087
 			'field_plus_id' => '',
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 			}
1135 1135
 		}
1136 1136
 
1137
-		if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) && ! $custom_error_fields ) {
1137
+		if ( isset( $args['errors']['field' . $args['field_id']] ) && ! $custom_error_fields ) {
1138 1138
 			if ( $error_comes_first ) {
1139 1139
 				array_unshift( $describedby, 'frm_error_' . $args['html_id'] );
1140 1140
 			} else {
@@ -1213,11 +1213,11 @@  discard block
 block discarded – undo
1213 1213
 
1214 1214
 		$field_id = $this->get_field_column( 'id' );
1215 1215
 		if ( ! array_key_exists( $field_id, $frm_validated_unique_values ) ) {
1216
-			$frm_validated_unique_values[ $field_id ] = array();
1216
+			$frm_validated_unique_values[$field_id] = array();
1217 1217
 			return false;
1218 1218
 		}
1219 1219
 
1220
-		$already_validated_this_value = in_array( $value, $frm_validated_unique_values[ $field_id ], true );
1220
+		$already_validated_this_value = in_array( $value, $frm_validated_unique_values[$field_id], true );
1221 1221
 		return $already_validated_this_value;
1222 1222
 	}
1223 1223
 
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 	private function value_validated_as_unique( $value ) {
1243 1243
 		global $frm_validated_unique_values;
1244 1244
 		$field_id                                   = $this->get_field_column( 'id' );
1245
-		$frm_validated_unique_values[ $field_id ][] = $value;
1245
+		$frm_validated_unique_values[$field_id][] = $value;
1246 1246
 	}
1247 1247
 
1248 1248
 	public function get_value_to_save( $value, $atts ) {
@@ -1274,8 +1274,8 @@  discard block
 block discarded – undo
1274 1274
 		$value = $this->prepare_display_value( $value, $atts );
1275 1275
 
1276 1276
 		if ( is_array( $value ) ) {
1277
-			if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) {
1278
-				$value = $value[ $atts['show'] ];
1277
+			if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) {
1278
+				$value = $value[$atts['show']];
1279 1279
 			} elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) {
1280 1280
 				$sep   = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
1281 1281
 				$value = implode( $sep, $value );
@@ -1344,8 +1344,8 @@  discard block
 block discarded – undo
1344 1344
 		$saved_entries = $atts['ids'];
1345 1345
 		$new_value     = array();
1346 1346
 		foreach ( (array) $value as $old_child_id ) {
1347
-			if ( isset( $saved_entries[ $old_child_id ] ) ) {
1348
-				$new_value[] = $saved_entries[ $old_child_id ];
1347
+			if ( isset( $saved_entries[$old_child_id] ) ) {
1348
+				$new_value[] = $saved_entries[$old_child_id];
1349 1349
 			}
1350 1350
 		}
1351 1351
 
Please login to merge, or discard this patch.
classes/views/styles/_style-card.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 				'text-color'      => $style->post_content['text_color'],
41 41
 				'submit-bg-color' => $style->post_content['submit_bg_color'],
42 42
 			);
43
-			$index  = 0;
43
+			$index = 0;
44 44
 			foreach ( $colors as $css_var_name => $color ) {
45 45
 				if ( 0 !== strpos( $color, 'rgb' ) ) {
46 46
 					$color = '#' . $color;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 					'style' => 'background-color: var(--' . $css_var_name . ')',
52 52
 				);
53 53
 
54
-				++$index;
54
+				++ $index;
55 55
 				?>
56 56
 				<div <?php FrmAppHelper::array_to_html_params( $circle_params, true ); ?>></div>
57 57
 				<?php
Please login to merge, or discard this patch.
classes/models/FrmFormApi.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 			if ( isset( $addon['categories'] ) ) {
106 106
 				$cats = array_intersect( $this->skip_categories(), $addon['categories'] );
107 107
 				if ( ! empty( $cats ) ) {
108
-					unset( $addons[ $k ] );
108
+					unset( $addons[$k] );
109 109
 					continue;
110 110
 				}
111 111
 			}
112 112
 
113 113
 			if ( ! array_key_exists( 'is_new', $addon ) && array_key_exists( 'released', $addon ) ) {
114
-				$addons[ $k ]['is_new'] = $this->is_new( $addon );
114
+				$addons[$k]['is_new'] = $this->is_new( $addon );
115 115
 			}
116 116
 		}
117 117
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 					return $addon;
154 154
 				}
155 155
 			}
156
-		} elseif ( isset( $addons[ $download_id ] ) ) {
157
-			$plugin = $addons[ $download_id ];
156
+		} elseif ( isset( $addons[$download_id] ) ) {
157
+			$plugin = $addons[$download_id];
158 158
 		}
159 159
 
160 160
 		return $plugin;
Please login to merge, or discard this patch.