Passed
Push — main ( 137754...ffd9e1 )
by TARIQ
04:53
created
packages/kirki-framework/field-typography/src/Field/CSS/Typography.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 	 * @param array $output The `output` item.
26 26
 	 * @param array $value  The field's value.
27 27
 	 */
28
-	protected function process_output( $output, $value ) {
28
+	protected function process_output($output, $value) {
29 29
 
30
-		$output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global';
31
-		$output['element']     = ( isset( $output['element'] ) ) ? $output['element'] : 'body';
32
-		$output['prefix']      = ( isset( $output['prefix'] ) ) ? $output['prefix'] : '';
33
-		$output['suffix']      = ( isset( $output['suffix'] ) ) ? $output['suffix'] : '';
30
+		$output['media_query'] = (isset($output['media_query'])) ? $output['media_query'] : 'global';
31
+		$output['element']     = (isset($output['element'])) ? $output['element'] : 'body';
32
+		$output['prefix']      = (isset($output['prefix'])) ? $output['prefix'] : '';
33
+		$output['suffix']      = (isset($output['suffix'])) ? $output['suffix'] : '';
34 34
 
35 35
 		$properties = [
36 36
 			'font-family',
@@ -49,46 +49,46 @@  discard block
 block discarded – undo
49 49
 			'margin-bottom',
50 50
 		];
51 51
 
52
-		foreach ( $properties as $property ) {
52
+		foreach ($properties as $property) {
53 53
 
54 54
 			// Early exit if the value is not in the defaults.
55
-			if ( ! isset( $this->field['default'][ $property ] ) ) {
55
+			if (!isset($this->field['default'][$property])) {
56 56
 				continue;
57 57
 			}
58 58
 
59 59
 			// Early exit if the value is not saved in the values.
60
-			if ( ! isset( $value[ $property ] ) || ! $value[ $property ] ) {
60
+			if (!isset($value[$property]) || !$value[$property]) {
61 61
 				continue;
62 62
 			}
63 63
 
64 64
 			// Early exit if we use "choice" but not for this property.
65
-			if ( isset( $output['choice'] ) && $output['choice'] !== $property ) {
65
+			if (isset($output['choice']) && $output['choice'] !== $property) {
66 66
 				continue;
67 67
 			}
68 68
 
69 69
 			// Take care of variants.
70
-			if ( 'variant' === $property && isset( $value['variant'] ) && ! empty( $value['variant'] ) ) {
70
+			if ('variant' === $property && isset($value['variant']) && !empty($value['variant'])) {
71 71
 
72 72
 				// Get the font_weight.
73
-				$font_weight = str_replace( 'italic', '', $value['variant'] );
74
-				$font_weight = ( in_array( $font_weight, [ '', 'regular' ], true ) ) ? '400' : $font_weight;
73
+				$font_weight = str_replace('italic', '', $value['variant']);
74
+				$font_weight = (in_array($font_weight, ['', 'regular'], true)) ? '400' : $font_weight;
75 75
 
76 76
 				// Is this italic?
77
-				$is_italic = ( false !== strpos( $value['variant'], 'italic' ) );
77
+				$is_italic = (false !== strpos($value['variant'], 'italic'));
78 78
 
79
-				$this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight;
79
+				$this->styles[$output['media_query']][$output['element']]['font-weight'] = $font_weight;
80 80
 
81
-				if ( $is_italic ) {
82
-					$this->styles[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic';
81
+				if ($is_italic) {
82
+					$this->styles[$output['media_query']][$output['element']]['font-style'] = 'italic';
83 83
 				}
84 84
 
85 85
 				continue;
86 86
 			}
87 87
 
88
-			$property_value = $this->process_property_value( $property, $value[ $property ] );
89
-			$property       = ( isset( $output['choice'] ) && isset( $output['property'] ) ) ? $output['property'] : $property;
90
-			$property_value = ( is_array( $property_value ) && isset( $property_value[0] ) ) ? $property_value[0] : $property_value;
91
-			$this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $property_value . $output['suffix'];
88
+			$property_value = $this->process_property_value($property, $value[$property]);
89
+			$property       = (isset($output['choice']) && isset($output['property'])) ? $output['property'] : $property;
90
+			$property_value = (is_array($property_value) && isset($property_value[0])) ? $property_value[0] : $property_value;
91
+			$this->styles[$output['media_query']][$output['element']][$property] = $output['prefix'] . $property_value . $output['suffix'];
92 92
 		}
93 93
 
94 94
 	}
Please login to merge, or discard this patch.
packages/kirki-framework/field-typography/src/Field/Typography.php 1 patch
Spacing   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -102,113 +102,113 @@  discard block
 block discarded – undo
102 102
 	 * @access public
103 103
 	 * @param array $args The arguments of the field.
104 104
 	 */
105
-	public function init( $args = [] ) {
105
+	public function init($args = []) {
106 106
 
107 107
 		self::$typography_controls[] = $args['settings'];
108 108
 
109 109
 		self::$std_variants = [
110 110
 			[
111 111
 				'value' => 'regular',
112
-				'label' => __( 'Regular', 'kirki' ),
112
+				'label' => __('Regular', 'kirki'),
113 113
 			],
114 114
 			[
115 115
 				'value' => 'italic',
116
-				'label' => __( 'Italic', 'kirki' ),
116
+				'label' => __('Italic', 'kirki'),
117 117
 			],
118 118
 			[
119 119
 				'value' => '700',
120
-				'label' => __( '700', 'kirki' ),
120
+				'label' => __('700', 'kirki'),
121 121
 			],
122 122
 			[
123 123
 				'value' => '700italic',
124
-				'label' => __( '700 Italic', 'kirki' ),
124
+				'label' => __('700 Italic', 'kirki'),
125 125
 			],
126 126
 		];
127 127
 
128 128
 		self::$complete_variants = [
129 129
 			[
130 130
 				'value' => 'regular',
131
-				'label' => __( 'Regular', 'kirki' ),
131
+				'label' => __('Regular', 'kirki'),
132 132
 			],
133 133
 			[
134 134
 				'value' => 'italic',
135
-				'label' => __( 'Italic', 'kirki' ),
135
+				'label' => __('Italic', 'kirki'),
136 136
 			],
137 137
 			[
138 138
 				'value' => '100',
139
-				'label' => __( '100', 'kirki' ),
139
+				'label' => __('100', 'kirki'),
140 140
 			],
141 141
 			[
142 142
 				'value' => '100italic',
143
-				'label' => __( '100 Italic', 'kirki' ),
143
+				'label' => __('100 Italic', 'kirki'),
144 144
 			],
145 145
 			[
146 146
 				'value' => '200',
147
-				'label' => __( '200', 'kirki' ),
147
+				'label' => __('200', 'kirki'),
148 148
 			],
149 149
 			[
150 150
 				'value' => '200italic',
151
-				'label' => __( '200 Italic', 'kirki' ),
151
+				'label' => __('200 Italic', 'kirki'),
152 152
 			],
153 153
 			[
154 154
 				'value' => '300',
155
-				'label' => __( '300', 'kirki' ),
155
+				'label' => __('300', 'kirki'),
156 156
 			],
157 157
 			[
158 158
 				'value' => '300italic',
159
-				'label' => __( '300 Italic', 'kirki' ),
159
+				'label' => __('300 Italic', 'kirki'),
160 160
 			],
161 161
 			[
162 162
 				'value' => '500',
163
-				'label' => __( '500', 'kirki' ),
163
+				'label' => __('500', 'kirki'),
164 164
 			],
165 165
 			[
166 166
 				'value' => '500italic',
167
-				'label' => __( '500 Italic', 'kirki' ),
167
+				'label' => __('500 Italic', 'kirki'),
168 168
 			],
169 169
 			[
170 170
 				'value' => '600',
171
-				'label' => __( '600', 'kirki' ),
171
+				'label' => __('600', 'kirki'),
172 172
 			],
173 173
 			[
174 174
 				'value' => '600italic',
175
-				'label' => __( '600 Italic', 'kirki' ),
175
+				'label' => __('600 Italic', 'kirki'),
176 176
 			],
177 177
 			[
178 178
 				'value' => '700',
179
-				'label' => __( '700', 'kirki' ),
179
+				'label' => __('700', 'kirki'),
180 180
 			],
181 181
 			[
182 182
 				'value' => '700italic',
183
-				'label' => __( '700 Italic', 'kirki' ),
183
+				'label' => __('700 Italic', 'kirki'),
184 184
 			],
185 185
 			[
186 186
 				'value' => '800',
187
-				'label' => __( '800', 'kirki' ),
187
+				'label' => __('800', 'kirki'),
188 188
 			],
189 189
 			[
190 190
 				'value' => '800italic',
191
-				'label' => __( '800 Italic', 'kirki' ),
191
+				'label' => __('800 Italic', 'kirki'),
192 192
 			],
193 193
 			[
194 194
 				'value' => '900',
195
-				'label' => __( '900', 'kirki' ),
195
+				'label' => __('900', 'kirki'),
196 196
 			],
197 197
 			[
198 198
 				'value' => '900italic',
199
-				'label' => __( '900 Italic', 'kirki' ),
199
+				'label' => __('900 Italic', 'kirki'),
200 200
 			],
201 201
 		];
202 202
 
203
-		foreach ( self::$complete_variants as $variants ) {
204
-			self::$complete_variant_labels[ $variants['value'] ] = $variants['label'];
203
+		foreach (self::$complete_variants as $variants) {
204
+			self::$complete_variant_labels[$variants['value']] = $variants['label'];
205 205
 		}
206 206
 
207
-		$this->add_sub_fields( $args );
207
+		$this->add_sub_fields($args);
208 208
 
209
-		add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_control_scripts' ] );
210
-		add_action( 'customize_preview_init', [ $this, 'enqueue_preview_scripts' ] );
211
-		add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] );
209
+		add_action('customize_controls_enqueue_scripts', [$this, 'enqueue_control_scripts']);
210
+		add_action('customize_preview_init', [$this, 'enqueue_preview_scripts']);
211
+		add_filter('kirki_output_control_classnames', [$this, 'output_control_classnames']);
212 212
 	}
213 213
 
214 214
 	/**
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 	 * @param array $args The field arguments.
220 220
 	 * @return void
221 221
 	 */
222
-	private function add_sub_fields( $args ) {
222
+	private function add_sub_fields($args) {
223 223
 
224
-		$args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global';
224
+		$args['kirki_config'] = isset($args['kirki_config']) ? $args['kirki_config'] : 'global';
225 225
 
226
-		$defaults = isset( $args['default'] ) ? $args['default'] : [];
226
+		$defaults = isset($args['default']) ? $args['default'] : [];
227 227
 
228 228
 		/**
229 229
 		 * Add a hidden field, the label & description.
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		new \Kirki\Field\Generic(
232 232
 			wp_parse_args(
233 233
 				[
234
-					'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : [ __CLASS__, 'sanitize' ],
234
+					'sanitize_callback' => isset($args['sanitize_callback']) ? $args['sanitize_callback'] : [__CLASS__, 'sanitize'],
235 235
 					'wrapper_opts'      => [
236 236
 						'gap' => 'small',
237 237
 					],
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			'data-kirki-parent-control-type' => 'kirki-typography',
252 252
 		];
253 253
 
254
-		if ( isset( $args['transport'] ) && 'auto' === $args['transport'] ) {
254
+		if (isset($args['transport']) && 'auto' === $args['transport']) {
255 255
 			$args['transport'] = 'postMessage';
256 256
 		}
257 257
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		 * They are grouped here because all they are required.
262 262
 		 * in order to get the right googlefont variant.
263 263
 		 */
264
-		if ( isset( $args['default']['font-family'] ) ) {
264
+		if (isset($args['default']['font-family'])) {
265 265
 
266 266
 			$args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-family';
267 267
 
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
 			new \Kirki\Field\ReactSelect(
272 272
 				wp_parse_args(
273 273
 					[
274
-						'label'       => esc_html__( 'Font Family', 'kirki' ),
274
+						'label'       => esc_html__('Font Family', 'kirki'),
275 275
 						'description' => '',
276 276
 						'settings'    => $args['settings'] . '[font-family]',
277
-						'default'     => isset( $args['default']['font-family'] ) ? $args['default']['font-family'] : '',
278
-						'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'font-family', $args ),
277
+						'default'     => isset($args['default']['font-family']) ? $args['default']['font-family'] : '',
278
+						'input_attrs' => $this->filter_preferred_choice_setting('input_attrs', 'font-family', $args),
279 279
 						'choices'     => [], // The choices will be populated later inside `get_font_family_choices` function in this file.
280 280
 						'css_vars'    => [],
281 281
 						'output'      => [],
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
 			/**
288 288
 			 * Add font variant.
289 289
 			 */
290
-			$font_variant = isset( $args['default']['variant'] ) ? $args['default']['variant'] : 'regular';
290
+			$font_variant = isset($args['default']['variant']) ? $args['default']['variant'] : 'regular';
291 291
 
292
-			if ( isset( $args['default']['font-weight'] ) ) {
292
+			if (isset($args['default']['font-weight'])) {
293 293
 				$font_variant = 400 === $args['default']['font-weight'] || '400' === $args['default']['font-weight'] ? 'regular' : $args['default']['font-weight'];
294 294
 			}
295 295
 
@@ -298,11 +298,11 @@  discard block
 block discarded – undo
298 298
 			new \Kirki\Field\ReactSelect(
299 299
 				wp_parse_args(
300 300
 					[
301
-						'label'       => esc_html__( 'Font Variant', 'kirki' ),
301
+						'label'       => esc_html__('Font Variant', 'kirki'),
302 302
 						'description' => '',
303 303
 						'settings'    => $args['settings'] . '[variant]',
304 304
 						'default'     => $font_variant,
305
-						'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'variant', $args ),
305
+						'input_attrs' => $this->filter_preferred_choice_setting('input_attrs', 'variant', $args),
306 306
 						'choices'     => [], // The choices will be populated later inside `get_variant_choices` function in this file.
307 307
 						'css_vars'    => [],
308 308
 						'output'      => [],
@@ -313,19 +313,19 @@  discard block
 block discarded – undo
313 313
 
314 314
 		}
315 315
 
316
-		$font_size_field_specified = isset( $defaults['font-size'] );
317
-		$color_field_specified     = isset( $defaults['color'] );
316
+		$font_size_field_specified = isset($defaults['font-size']);
317
+		$color_field_specified     = isset($defaults['color']);
318 318
 
319
-		if ( $font_size_field_specified || $color_field_specified ) {
319
+		if ($font_size_field_specified || $color_field_specified) {
320 320
 			$group = [
321 321
 				'font-size' => [
322 322
 					'type'         => 'dimension',
323
-					'label'        => esc_html__( 'Font Size', 'kirki' ),
323
+					'label'        => esc_html__('Font Size', 'kirki'),
324 324
 					'is_specified' => $font_size_field_specified,
325 325
 				],
326 326
 				'color'     => [
327 327
 					'type'         => 'react-colorful',
328
-					'label'        => esc_html__( 'Font Color', 'kirki' ),
328
+					'label'        => esc_html__('Font Color', 'kirki'),
329 329
 					'is_specified' => $color_field_specified,
330 330
 					'choices'      => [
331 331
 						'alpha'       => true,
@@ -334,102 +334,102 @@  discard block
 block discarded – undo
334 334
 				],
335 335
 			];
336 336
 
337
-			$this->generate_controls_group( $group, $args );
337
+			$this->generate_controls_group($group, $args);
338 338
 		}
339 339
 
340
-		$text_align_field_specified     = isset( $defaults['text-align'] );
341
-		$text_transform_field_specified = isset( $defaults['text-transform'] );
340
+		$text_align_field_specified     = isset($defaults['text-align']);
341
+		$text_transform_field_specified = isset($defaults['text-transform']);
342 342
 
343
-		if ( $text_align_field_specified || $text_transform_field_specified ) {
343
+		if ($text_align_field_specified || $text_transform_field_specified) {
344 344
 			$group = [
345 345
 				'text-align'     => [
346 346
 					'type'         => 'react-select',
347
-					'label'        => esc_html__( 'Text Align', 'kirki' ),
347
+					'label'        => esc_html__('Text Align', 'kirki'),
348 348
 					'is_specified' => $text_align_field_specified,
349 349
 					'choices'      => [
350
-						'initial' => esc_html__( 'Initial', 'kirki' ),
351
-						'left'    => esc_html__( 'Left', 'kirki' ),
352
-						'center'  => esc_html__( 'Center', 'kirki' ),
353
-						'right'   => esc_html__( 'Right', 'kirki' ),
354
-						'justify' => esc_html__( 'Justify', 'kirki' ),
350
+						'initial' => esc_html__('Initial', 'kirki'),
351
+						'left'    => esc_html__('Left', 'kirki'),
352
+						'center'  => esc_html__('Center', 'kirki'),
353
+						'right'   => esc_html__('Right', 'kirki'),
354
+						'justify' => esc_html__('Justify', 'kirki'),
355 355
 					],
356 356
 				],
357 357
 				'text-transform' => [
358 358
 					'type'         => 'react-select',
359
-					'label'        => esc_html__( 'Text Transform', 'kirki' ),
359
+					'label'        => esc_html__('Text Transform', 'kirki'),
360 360
 					'is_specified' => $text_transform_field_specified,
361 361
 					'choices'      => [
362
-						'none'       => esc_html__( 'None', 'kirki' ),
363
-						'capitalize' => esc_html__( 'Capitalize', 'kirki' ),
364
-						'uppercase'  => esc_html__( 'Uppercase', 'kirki' ),
365
-						'lowercase'  => esc_html__( 'Lowercase', 'kirki' ),
362
+						'none'       => esc_html__('None', 'kirki'),
363
+						'capitalize' => esc_html__('Capitalize', 'kirki'),
364
+						'uppercase'  => esc_html__('Uppercase', 'kirki'),
365
+						'lowercase'  => esc_html__('Lowercase', 'kirki'),
366 366
 					],
367 367
 				],
368 368
 			];
369 369
 
370
-			$this->generate_controls_group( $group, $args );
370
+			$this->generate_controls_group($group, $args);
371 371
 		}
372 372
 
373
-		$text_decoration_field_specified = isset( $defaults['text-decoration'] );
373
+		$text_decoration_field_specified = isset($defaults['text-decoration']);
374 374
 
375
-		if ( $text_decoration_field_specified ) {
375
+		if ($text_decoration_field_specified) {
376 376
 			$group = [
377 377
 				'text-decoration' => [
378 378
 					'type'         => 'react-select',
379
-					'label'        => esc_html__( 'Text Decoration', 'kirki' ),
379
+					'label'        => esc_html__('Text Decoration', 'kirki'),
380 380
 					'is_specified' => $text_decoration_field_specified,
381 381
 					'choices'      => [
382
-						'none'         => esc_html__( 'None', 'kirki' ),
383
-						'underline'    => esc_html__( 'Underline', 'kirki' ),
384
-						'line-through' => esc_html__( 'Line Through', 'kirki' ),
385
-						'overline'     => esc_html__( 'Overline', 'kirki' ),
386
-						'solid'        => esc_html__( 'Solid', 'kirki' ),
387
-						'wavy'         => esc_html__( 'Wavy', 'kirki' ),
382
+						'none'         => esc_html__('None', 'kirki'),
383
+						'underline'    => esc_html__('Underline', 'kirki'),
384
+						'line-through' => esc_html__('Line Through', 'kirki'),
385
+						'overline'     => esc_html__('Overline', 'kirki'),
386
+						'solid'        => esc_html__('Solid', 'kirki'),
387
+						'wavy'         => esc_html__('Wavy', 'kirki'),
388 388
 					],
389 389
 				],
390 390
 			];
391 391
 
392
-			$this->generate_controls_group( $group, $args );
392
+			$this->generate_controls_group($group, $args);
393 393
 		}
394 394
 
395
-		$line_height_field_specified    = isset( $defaults['line-height'] );
396
-		$letter_spacing_field_specified = isset( $defaults['letter-spacing'] );
395
+		$line_height_field_specified    = isset($defaults['line-height']);
396
+		$letter_spacing_field_specified = isset($defaults['letter-spacing']);
397 397
 
398
-		if ( $line_height_field_specified || $letter_spacing_field_specified ) {
398
+		if ($line_height_field_specified || $letter_spacing_field_specified) {
399 399
 			$group = [
400 400
 				'line-height'    => [
401 401
 					'type'         => 'dimension',
402
-					'label'        => esc_html__( 'Line Height', 'kirki' ),
402
+					'label'        => esc_html__('Line Height', 'kirki'),
403 403
 					'is_specified' => $line_height_field_specified,
404 404
 				],
405 405
 				'letter-spacing' => [
406 406
 					'type'         => 'dimension',
407
-					'label'        => esc_html__( 'Letter Spacing', 'kirki' ),
407
+					'label'        => esc_html__('Letter Spacing', 'kirki'),
408 408
 					'is_specified' => $letter_spacing_field_specified,
409 409
 				],
410 410
 			];
411 411
 
412
-			$this->generate_controls_group( $group, $args );
412
+			$this->generate_controls_group($group, $args);
413 413
 		}
414 414
 
415
-		$margin_top_field_specified    = isset( $defaults['margin-top'] );
416
-		$margin_bottom_field_specified = isset( $defaults['margin-bottom'] );
415
+		$margin_top_field_specified    = isset($defaults['margin-top']);
416
+		$margin_bottom_field_specified = isset($defaults['margin-bottom']);
417 417
 
418
-		if ( $margin_top_field_specified || $margin_bottom_field_specified ) {
418
+		if ($margin_top_field_specified || $margin_bottom_field_specified) {
419 419
 			$group = [
420 420
 				'margin-top'    => [
421 421
 					'type'         => 'dimension',
422
-					'label'        => esc_html__( 'Margin Top', 'kirki' ),
422
+					'label'        => esc_html__('Margin Top', 'kirki'),
423 423
 					'is_specified' => $margin_top_field_specified,
424 424
 				],
425 425
 				'margin-bottom' => [
426 426
 					'type'         => 'dimension',
427
-					'label'        => esc_html__( 'Margin Bottom', 'kirki' ),
427
+					'label'        => esc_html__('Margin Bottom', 'kirki'),
428 428
 					'is_specified' => $margin_bottom_field_specified,
429 429
 				],
430 430
 			];
431 431
 
432
-			$this->generate_controls_group( $group, $args );
432
+			$this->generate_controls_group($group, $args);
433 433
 		}
434 434
 
435 435
 	}
@@ -440,42 +440,42 @@  discard block
 block discarded – undo
440 440
 	 * @param array $group The group data.
441 441
 	 * @param array $args The field args.
442 442
 	 */
443
-	public function generate_controls_group( $group, $args ) {
443
+	public function generate_controls_group($group, $args) {
444 444
 
445 445
 		$total_specified = 0;
446 446
 		$field_width     = 100;
447 447
 
448
-		foreach ( $group as $css_prop => $control ) {
449
-			if ( $control['is_specified'] ) {
448
+		foreach ($group as $css_prop => $control) {
449
+			if ($control['is_specified']) {
450 450
 				$total_specified++;
451 451
 			}
452 452
 		}
453 453
 
454
-		if ( $total_specified > 1 ) {
455
-			$field_width = floor( 100 / $total_specified );
454
+		if ($total_specified > 1) {
455
+			$field_width = floor(100 / $total_specified);
456 456
 		}
457 457
 
458 458
 		$group_count = 0;
459 459
 
460
-		foreach ( $group as $css_prop => $control ) {
461
-			if ( $control['is_specified'] ) {
460
+		foreach ($group as $css_prop => $control) {
461
+			if ($control['is_specified']) {
462 462
 				$group_count++;
463 463
 
464 464
 				$group_classname  = 'kirki-group-item';
465
-				$group_classname .= 1 === $group_count ? ' kirki-group-start' : ( $group_count === $total_specified ? ' kirki-group-end' : '' );
465
+				$group_classname .= 1 === $group_count ? ' kirki-group-start' : ($group_count === $total_specified ? ' kirki-group-end' : '');
466 466
 
467
-				$control_class = str_ireplace( '-', ' ', $control['type'] );
468
-				$control_class = ucwords( $control_class );
469
-				$control_class = str_replace( ' ', '', $control_class );
467
+				$control_class = str_ireplace('-', ' ', $control['type']);
468
+				$control_class = ucwords($control_class);
469
+				$control_class = str_replace(' ', '', $control_class);
470 470
 				$control_class = '\\Kirki\\Field\\' . $control_class;
471 471
 
472 472
 				new $control_class(
473 473
 					wp_parse_args(
474 474
 						[
475
-							'label'         => isset( $control['label'] ) ? $control['label'] : '',
476
-							'description'   => isset( $control['description'] ) ? $control['description'] : '',
475
+							'label'         => isset($control['label']) ? $control['label'] : '',
476
+							'description'   => isset($control['description']) ? $control['description'] : '',
477 477
 							'settings'      => $args['settings'] . '[' . $css_prop . ']',
478
-							'default'       => $args['default'][ $css_prop ],
478
+							'default'       => $args['default'][$css_prop],
479 479
 							'wrapper_attrs' => wp_parse_args(
480 480
 								[
481 481
 									'data-kirki-typography-css-prop' => $css_prop,
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 								],
485 485
 								$args['wrapper_attrs']
486 486
 							),
487
-							'input_attrs'   => $this->filter_preferred_choice_setting( 'input_attrs', $css_prop, $args ),
488
-							'choices'       => ( isset( $control['choices'] ) ? $control['choices'] : [] ),
487
+							'input_attrs'   => $this->filter_preferred_choice_setting('input_attrs', $css_prop, $args),
488
+							'choices'       => (isset($control['choices']) ? $control['choices'] : []),
489 489
 							'css_vars'      => [],
490 490
 							'output'        => [],
491 491
 						],
@@ -506,60 +506,60 @@  discard block
 block discarded – undo
506 506
 	 * @param array $value The value.
507 507
 	 * @return array
508 508
 	 */
509
-	public static function sanitize( $value ) {
509
+	public static function sanitize($value) {
510 510
 
511
-		if ( ! is_array( $value ) ) {
511
+		if (!is_array($value)) {
512 512
 			return [];
513 513
 		}
514 514
 
515
-		foreach ( $value as $key => $val ) {
516
-			switch ( $key ) {
515
+		foreach ($value as $key => $val) {
516
+			switch ($key) {
517 517
 				case 'font-family':
518
-					$value['font-family'] = sanitize_text_field( $val );
518
+					$value['font-family'] = sanitize_text_field($val);
519 519
 					break;
520 520
 
521 521
 				case 'variant':
522 522
 					// Use 'regular' instead of 400 for font-variant.
523
-					$value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val;
523
+					$value['variant'] = (400 === $val || '400' === $val) ? 'regular' : $val;
524 524
 
525 525
 					// Get font-weight from variant.
526
-					$value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
527
-					$value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? '400' : (string) absint( $value['font-weight'] );
526
+					$value['font-weight'] = filter_var($value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
527
+					$value['font-weight'] = ('regular' === $value['variant'] || 'italic' === $value['variant']) ? '400' : (string) absint($value['font-weight']);
528 528
 
529 529
 					// Get font-style from variant.
530
-					if ( ! isset( $value['font-style'] ) ) {
531
-						$value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic';
530
+					if (!isset($value['font-style'])) {
531
+						$value['font-style'] = (false === strpos($value['variant'], 'italic')) ? 'normal' : 'italic';
532 532
 					}
533 533
 
534 534
 					break;
535 535
 
536 536
 				case 'text-align':
537
-					if ( ! in_array( $val, [ '', 'inherit', 'left', 'center', 'right', 'justify' ], true ) ) {
537
+					if (!in_array($val, ['', 'inherit', 'left', 'center', 'right', 'justify'], true)) {
538 538
 						$value['text-align'] = '';
539 539
 					}
540 540
 
541 541
 					break;
542 542
 
543 543
 				case 'text-transform':
544
-					if ( ! in_array( $val, [ '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ], true ) ) {
544
+					if (!in_array($val, ['', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit'], true)) {
545 545
 						$value['text-transform'] = '';
546 546
 					}
547 547
 
548 548
 					break;
549 549
 
550 550
 				case 'text-decoration':
551
-					if ( ! in_array( $val, [ '', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit' ], true ) ) {
551
+					if (!in_array($val, ['', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit'], true)) {
552 552
 						$value['text-transform'] = '';
553 553
 					}
554 554
 
555 555
 					break;
556 556
 
557 557
 				case 'color':
558
-					$value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize( $value['color'] );
558
+					$value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize($value['color']);
559 559
 					break;
560 560
 
561 561
 				default:
562
-					$value[ $key ] = sanitize_text_field( $value[ $key ] );
562
+					$value[$key] = sanitize_text_field($value[$key]);
563 563
 			}
564 564
 		}
565 565
 
@@ -576,45 +576,45 @@  discard block
 block discarded – undo
576 576
 	 */
577 577
 	public function enqueue_control_scripts() {
578 578
 
579
-		wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' );
579
+		wp_enqueue_style('kirki-control-typography', \Kirki\URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.css'), [], '1.0');
580 580
 
581
-		wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true );
581
+		wp_enqueue_script('kirki-control-typography', \Kirki\URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.js'), [], '1.0', true);
582 582
 
583
-		wp_localize_script( 'kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls );
583
+		wp_localize_script('kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls);
584 584
 
585 585
 		$args = $this->args;
586 586
 
587 587
 		$variants = [];
588 588
 
589 589
 		// Add custom variants (for custom fonts) to the $variants.
590
-		if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) {
590
+		if (isset($args['choices']) && isset($args['choices']['fonts']) && isset($args['choices']['fonts']['families'])) {
591 591
 
592 592
 			// If $args['choices']['fonts']['families'] exists, then loop it.
593
-			foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) {
593
+			foreach ($args['choices']['fonts']['families'] as $font_family_key => $font_family_value) {
594 594
 
595 595
 				// Then loop the $font_family_value['children].
596
-				foreach ( $font_family_value['children'] as $font_family ) {
596
+				foreach ($font_family_value['children'] as $font_family) {
597 597
 
598 598
 					// Then check if $font_family['id'] exists in variants argument.
599
-					if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) {
599
+					if (isset($args['choices']['fonts']['variants']) && isset($args['choices']['fonts']['variants'][$font_family['id']])) {
600 600
 
601 601
 						// Create new array if $variants[ $font_family['id'] ] doesn't exist.
602
-						if ( ! isset( $variants[ $font_family['id'] ] ) ) {
603
-							$variants[ $font_family['id'] ] = [];
602
+						if (!isset($variants[$font_family['id']])) {
603
+							$variants[$font_family['id']] = [];
604 604
 						}
605 605
 
606 606
 						// The $custom_variant here can be something like "400italic" or "italic".
607
-						foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) {
607
+						foreach ($args['choices']['fonts']['variants'][$font_family['id']] as $custom_variant) {
608 608
 
609 609
 							// Check if $custom_variant exists in self::$complete_variant_labels.
610
-							if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) {
610
+							if (isset(self::$complete_variant_labels[$custom_variant])) {
611 611
 
612 612
 								// If it exists, assign it to $variants[ $font_family['id'] ], so that they will be available in JS object.
613 613
 								array_push(
614
-									$variants[ $font_family['id'] ],
614
+									$variants[$font_family['id']],
615 615
 									[
616 616
 										'value' => $custom_variant,
617
-										'label' => self::$complete_variant_labels[ $custom_variant ],
617
+										'label' => self::$complete_variant_labels[$custom_variant],
618 618
 									]
619 619
 								);
620 620
 
@@ -625,29 +625,29 @@  discard block
 block discarded – undo
625 625
 			} // End of $args['choices']['fonts']['families'] foreach.
626 626
 		} // End of $args['choices']['fonts']['families'] if.
627 627
 
628
-		if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) {
628
+		if (!isset($args['choices']['fonts']) || !isset($args['choices']['fonts']['standard'])) {
629 629
 			$standard_fonts = Fonts::get_standard_fonts();
630 630
 
631
-			foreach ( $standard_fonts as $font ) {
632
-				if ( isset( $font['variants'] ) ) {
631
+			foreach ($standard_fonts as $font) {
632
+				if (isset($font['variants'])) {
633 633
 
634 634
 					// Create new array if $variants[ $font['stack'] ] doesn't exist.
635
-					if ( ! isset( $variants[ $font['stack'] ] ) ) {
636
-						$variants[ $font['stack'] ] = [];
635
+					if (!isset($variants[$font['stack']])) {
636
+						$variants[$font['stack']] = [];
637 637
 					}
638 638
 
639 639
 					// The $std_variant here can be something like "400italic" or "italic".
640
-					foreach ( $font['variants'] as $std_variant ) {
640
+					foreach ($font['variants'] as $std_variant) {
641 641
 
642 642
 						// Check if $std_variant exists in self::$complete_variant_labels.
643
-						if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) {
643
+						if (isset(self::$complete_variant_labels[$std_variant])) {
644 644
 
645 645
 							// If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object.
646 646
 							array_push(
647
-								$variants[ $font['stack'] ],
647
+								$variants[$font['stack']],
648 648
 								[
649 649
 									'value' => $std_variant,
650
-									'label' => self::$complete_variant_labels[ $std_variant ],
650
+									'label' => self::$complete_variant_labels[$std_variant],
651 651
 								]
652 652
 							);
653 653
 
@@ -655,29 +655,29 @@  discard block
 block discarded – undo
655 655
 					} // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach.
656 656
 				}
657 657
 			}
658
-		} elseif ( is_array( $args['choices']['fonts']['standard'] ) ) {
659
-			foreach ( $args['choices']['fonts']['standard'] as $key => $val ) {
660
-				$key = ( is_int( $key ) ) ? $val : $key;
658
+		} elseif (is_array($args['choices']['fonts']['standard'])) {
659
+			foreach ($args['choices']['fonts']['standard'] as $key => $val) {
660
+				$key = (is_int($key)) ? $val : $key;
661 661
 
662
-				if ( isset( $val['variants'] ) ) {
662
+				if (isset($val['variants'])) {
663 663
 
664 664
 					// Create new array if $variants[ $font['stack'] ] doesn't exist.
665
-					if ( ! isset( $variants[ $key ] ) ) {
666
-						$variants[ $key ] = [];
665
+					if (!isset($variants[$key])) {
666
+						$variants[$key] = [];
667 667
 					}
668 668
 
669 669
 					// The $std_variant here can be something like "400italic" or "italic".
670
-					foreach ( $val['variants'] as $std_variant ) {
670
+					foreach ($val['variants'] as $std_variant) {
671 671
 
672 672
 						// Check if $std_variant exists in self::$complete_variant_labels.
673
-						if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) {
673
+						if (isset(self::$complete_variant_labels[$std_variant])) {
674 674
 
675 675
 							// If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object.
676 676
 							array_push(
677
-								$variants[ $key ],
677
+								$variants[$key],
678 678
 								[
679 679
 									'value' => $std_variant,
680
-									'label' => self::$complete_variant_labels[ $std_variant ],
680
+									'label' => self::$complete_variant_labels[$std_variant],
681 681
 								]
682 682
 							);
683 683
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 		}
689 689
 
690 690
 		// Scripts inside this block will only be executed once.
691
-		if ( ! self::$fonts_var_added ) {
691
+		if (!self::$fonts_var_added) {
692 692
 			wp_localize_script(
693 693
 				'kirki-control-typography',
694 694
 				'kirkiFontVariants',
@@ -700,16 +700,16 @@  discard block
 block discarded – undo
700 700
 
701 701
 			$google = new GoogleFonts();
702 702
 
703
-			wp_localize_script( 'kirki-control-typography', 'kirkiGoogleFonts', $google->get_array() );
704
-			wp_add_inline_script( 'kirki-control-typography', 'var kirkiCustomVariants = {};', 'before' );
703
+			wp_localize_script('kirki-control-typography', 'kirkiGoogleFonts', $google->get_array());
704
+			wp_add_inline_script('kirki-control-typography', 'var kirkiCustomVariants = {};', 'before');
705 705
 
706 706
 			self::$fonts_var_added = true;
707 707
 		}
708 708
 
709 709
 		// This custom variants will be available for each typography control.
710
-		$custom_variant_key   = str_ireplace( ']', '', $args['settings'] );
711
-		$custom_variant_key   = str_ireplace( '[', '_', $custom_variant_key );
712
-		$custom_variant_value = wp_json_encode( Helper::prepare_php_array_for_js( $variants ) );
710
+		$custom_variant_key   = str_ireplace(']', '', $args['settings']);
711
+		$custom_variant_key   = str_ireplace('[', '_', $custom_variant_key);
712
+		$custom_variant_value = wp_json_encode(Helper::prepare_php_array_for_js($variants));
713 713
 
714 714
 		wp_add_inline_script(
715 715
 			'kirki-control-typography',
@@ -728,9 +728,9 @@  discard block
 block discarded – undo
728 728
 	 */
729 729
 	public function enqueue_preview_scripts() {
730 730
 
731
-		wp_enqueue_script( 'kirki-preview-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/preview.js' ), [ 'wp-hooks' ], '1.0', true );
731
+		wp_enqueue_script('kirki-preview-typography', \Kirki\URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/preview.js'), ['wp-hooks'], '1.0', true);
732 732
 
733
-		if ( ! self::$preview_var_added ) {
733
+		if (!self::$preview_var_added) {
734 734
 			$google = new GoogleFonts();
735 735
 
736 736
 			wp_localize_script(
@@ -755,28 +755,28 @@  discard block
 block discarded – undo
755 755
 	 *
756 756
 	 * @return string
757 757
 	 */
758
-	public function filter_preferred_choice_setting( $setting, $choice, $args ) {
758
+	public function filter_preferred_choice_setting($setting, $choice, $args) {
759 759
 
760 760
 		// Fail early.
761
-		if ( ! isset( $args[ $setting ] ) ) {
761
+		if (!isset($args[$setting])) {
762 762
 			return '';
763 763
 		}
764 764
 
765 765
 		// If a specific field for the choice is set
766
-		if ( isset( $args[ $setting ][ $choice ] ) ) {
767
-			return $args[ $setting ][ $choice ];
766
+		if (isset($args[$setting][$choice])) {
767
+			return $args[$setting][$choice];
768 768
 		}
769 769
 
770 770
 		// Unset input_attrs of all other choices.
771
-		foreach ( $args['choices'] as $id => $set ) {
772
-			if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) {
773
-				unset( $args[ $setting ][ $id ] );
774
-			} elseif ( ! isset( $args[ $setting ][ $id ] ) ) {
775
-				$args[ $setting ] = '';
771
+		foreach ($args['choices'] as $id => $set) {
772
+			if ($id !== $choice && isset($args[$setting][$id])) {
773
+				unset($args[$setting][$id]);
774
+			} elseif (!isset($args[$setting][$id])) {
775
+				$args[$setting] = '';
776 776
 			}
777 777
 		}
778 778
 
779
-		return $args[ $setting ];
779
+		return $args[$setting];
780 780
 
781 781
 	}
782 782
 
@@ -803,11 +803,11 @@  discard block
 block discarded – undo
803 803
 		$max_fonts = 9999;
804 804
 		$google    = new GoogleFonts();
805 805
 
806
-		if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['google'] ) && ! empty( $args['choices']['fonts']['google'] ) ) {
807
-			if ( in_array( $args['choices']['fonts']['google'][0], [ 'alpha', 'popularity', 'trending' ], true ) ) {
806
+		if (isset($args['choices']) && isset($args['choices']['fonts']) && isset($args['choices']['fonts']['google']) && !empty($args['choices']['fonts']['google'])) {
807
+			if (in_array($args['choices']['fonts']['google'][0], ['alpha', 'popularity', 'trending'], true)) {
808 808
 				$sorting = $args['choices']['fonts']['google'][0];
809 809
 
810
-				if ( isset( $args['choices']['fonts']['google'][1] ) && is_int( $args['choices']['fonts']['google'][1] ) ) {
810
+				if (isset($args['choices']['fonts']['google'][1]) && is_int($args['choices']['fonts']['google'][1])) {
811 811
 					$max_fonts = (int) $args['choices']['fonts']['google'][1];
812 812
 				}
813 813
 
@@ -831,42 +831,42 @@  discard block
 block discarded – undo
831 831
 
832 832
 		$std_fonts = [];
833 833
 
834
-		if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) {
834
+		if (!isset($args['choices']['fonts']) || !isset($args['choices']['fonts']['standard'])) {
835 835
 			$standard_fonts = Fonts::get_standard_fonts();
836 836
 
837
-			foreach ( $standard_fonts as $font ) {
838
-				$std_fonts[ $font['stack'] ] = $font['label'];
837
+			foreach ($standard_fonts as $font) {
838
+				$std_fonts[$font['stack']] = $font['label'];
839 839
 			}
840
-		} elseif ( is_array( $args['choices']['fonts']['standard'] ) ) {
841
-			foreach ( $args['choices']['fonts']['standard'] as $key => $val ) {
842
-				$key               = ( \is_int( $key ) ) ? $val : $key;
843
-				$std_fonts[ $key ] = $val;
840
+		} elseif (is_array($args['choices']['fonts']['standard'])) {
841
+			foreach ($args['choices']['fonts']['standard'] as $key => $val) {
842
+				$key               = (\is_int($key)) ? $val : $key;
843
+				$std_fonts[$key] = $val;
844 844
 			}
845 845
 		}
846 846
 
847 847
 		$choices = [];
848 848
 
849 849
 		$choices['default'] = [
850
-			esc_html__( 'Defaults', 'kirki' ),
850
+			esc_html__('Defaults', 'kirki'),
851 851
 			[
852
-				'' => esc_html__( 'Default', 'kirki' ),
852
+				'' => esc_html__('Default', 'kirki'),
853 853
 			],
854 854
 		];
855 855
 
856
-		if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) {
856
+		if (isset($args['choices']) && isset($args['choices']['fonts']) && isset($args['choices']['fonts']['families'])) {
857 857
 			// Implementing the custom font families.
858
-			foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) {
859
-				if ( ! isset( $choices[ $font_family_key ] ) ) {
860
-					$choices[ $font_family_key ] = [];
858
+			foreach ($args['choices']['fonts']['families'] as $font_family_key => $font_family_value) {
859
+				if (!isset($choices[$font_family_key])) {
860
+					$choices[$font_family_key] = [];
861 861
 				}
862 862
 
863 863
 				$family_opts = [];
864 864
 
865
-				foreach ( $font_family_value['children'] as $font_family ) {
866
-					$family_opts[ $font_family['id'] ] = $font_family['text'];
865
+				foreach ($font_family_value['children'] as $font_family) {
866
+					$family_opts[$font_family['id']] = $font_family['text'];
867 867
 				}
868 868
 
869
-				$choices[ $font_family_key ] = [
869
+				$choices[$font_family_key] = [
870 870
 					$font_family_value['text'],
871 871
 					$family_opts,
872 872
 				];
@@ -874,18 +874,18 @@  discard block
 block discarded – undo
874 874
 		}
875 875
 
876 876
 		$choices['standard'] = [
877
-			esc_html__( 'Standard Fonts', 'kirki' ),
877
+			esc_html__('Standard Fonts', 'kirki'),
878 878
 			$std_fonts,
879 879
 		];
880 880
 
881 881
 		$choices['google'] = [
882
-			esc_html__( 'Google Fonts', 'kirki' ),
883
-			array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ),
882
+			esc_html__('Google Fonts', 'kirki'),
883
+			array_combine(array_values($g_fonts), array_values($g_fonts)),
884 884
 		];
885 885
 
886
-		if ( empty( $choices['standard'][1] ) ) {
887
-			$choices = array_combine( array_values( $g_fonts ), array_values( $g_fonts ) );
888
-		} elseif ( empty( $choices['google'][1] ) ) {
886
+		if (empty($choices['standard'][1])) {
887
+			$choices = array_combine(array_values($g_fonts), array_values($g_fonts));
888
+		} elseif (empty($choices['google'][1])) {
889 889
 			$choices = $std_fonts;
890 890
 		}
891 891
 
@@ -914,31 +914,31 @@  discard block
 block discarded – undo
914 914
 		$choices = self::$std_variants;
915 915
 
916 916
 		// Implementing the custom variants for custom fonts.
917
-		if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) {
917
+		if (isset($args['choices']) && isset($args['choices']['fonts']) && isset($args['choices']['fonts']['families'])) {
918 918
 
919 919
 			$choices = [];
920 920
 
921 921
 			// If $args['choices']['fonts']['families'] exists, then loop it.
922
-			foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) {
922
+			foreach ($args['choices']['fonts']['families'] as $font_family_key => $font_family_value) {
923 923
 
924 924
 				// Then loop the $font_family_value['children].
925
-				foreach ( $font_family_value['children'] as $font_family ) {
925
+				foreach ($font_family_value['children'] as $font_family) {
926 926
 
927 927
 					// Then check if $font_family['id'] exists in $args['choices']['fonts']['variants'].
928
-					if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) {
928
+					if (isset($args['choices']['fonts']['variants']) && isset($args['choices']['fonts']['variants'][$font_family['id']])) {
929 929
 
930 930
 						// The $custom_variant here can be something like "400italic" or "italic".
931
-						foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) {
931
+						foreach ($args['choices']['fonts']['variants'][$font_family['id']] as $custom_variant) {
932 932
 
933 933
 							// Check if $custom_variant exists in self::$complete_variant_labels.
934
-							if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) {
934
+							if (isset(self::$complete_variant_labels[$custom_variant])) {
935 935
 
936 936
 								// If it exists, assign it to $choices.
937 937
 								array_push(
938 938
 									$choices,
939 939
 									[
940 940
 										'value' => $custom_variant,
941
-										'label' => self::$complete_variant_labels[ $custom_variant ],
941
+										'label' => self::$complete_variant_labels[$custom_variant],
942 942
 									]
943 943
 								);
944 944
 
@@ -962,15 +962,15 @@  discard block
 block discarded – undo
962 962
 	 * @param WP_Customize_Manager $wp_customize The customizer instance.
963 963
 	 * @return array
964 964
 	 */
965
-	public function filter_control_args( $args, $wp_customize ) {
965
+	public function filter_control_args($args, $wp_customize) {
966 966
 
967
-		if ( $args['settings'] === $this->args['settings'] . '[font-family]' ) {
968
-			$args            = parent::filter_control_args( $args, $wp_customize );
967
+		if ($args['settings'] === $this->args['settings'] . '[font-family]') {
968
+			$args            = parent::filter_control_args($args, $wp_customize);
969 969
 			$args['choices'] = $this->get_font_family_choices();
970 970
 		}
971 971
 
972
-		if ( $args['settings'] === $this->args['settings'] . '[variant]' ) {
973
-			$args            = parent::filter_control_args( $args, $wp_customize );
972
+		if ($args['settings'] === $this->args['settings'] . '[variant]') {
973
+			$args            = parent::filter_control_args($args, $wp_customize);
974 974
 			$args['choices'] = $this->get_variant_choices();
975 975
 		}
976 976
 
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
 	 * @param array $classnames The array of classnames.
987 987
 	 * @return array
988 988
 	 */
989
-	public function output_control_classnames( $classnames ) {
989
+	public function output_control_classnames($classnames) {
990 990
 
991 991
 		$classnames['kirki-typography'] = '\Kirki\Field\CSS\Typography';
992 992
 		return $classnames;
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 	 * @param WP_Customize_Manager $wp_customize The customizer instance.
1002 1002
 	 * @return void
1003 1003
 	 */
1004
-	public function add_setting( $wp_customize ) {}
1004
+	public function add_setting($wp_customize) {}
1005 1005
 
1006 1006
 	/**
1007 1007
 	 * Override the parent method. No need for a control.
@@ -1011,6 +1011,6 @@  discard block
 block discarded – undo
1011 1011
 	 * @param WP_Customize_Manager $wp_customize The customizer instance.
1012 1012
 	 * @return void
1013 1013
 	 */
1014
-	public function add_control( $wp_customize ) {}
1014
+	public function add_control($wp_customize) {}
1015 1015
 
1016 1016
 }
Please login to merge, or discard this patch.
packages/kirki-framework/control-radio/src/Field/Radio_Buttonset.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@
 block discarded – undo
44 44
 	 * @param WP_Customize_Manager $wp_customize The customizer instance.
45 45
 	 * @return array
46 46
 	 */
47
-	public function filter_control_args( $args, $wp_customize ) {
48
-		if ( $args['settings'] === $this->args['settings'] ) {
49
-			$args         = parent::filter_control_args( $args, $wp_customize );
47
+	public function filter_control_args($args, $wp_customize) {
48
+		if ($args['settings'] === $this->args['settings']) {
49
+			$args         = parent::filter_control_args($args, $wp_customize);
50 50
 			$args['type'] = 'kirki-radio-buttonset';
51 51
 		}
52 52
 		return $args;
Please login to merge, or discard this patch.
packages/kirki-framework/control-radio/src/Field/Radio_Image.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@
 block discarded – undo
44 44
 	 * @param WP_Customize_Manager $wp_customize The customizer instance.
45 45
 	 * @return array
46 46
 	 */
47
-	public function filter_control_args( $args, $wp_customize ) {
48
-		if ( $args['settings'] === $this->args['settings'] ) {
49
-			$args         = parent::filter_control_args( $args, $wp_customize );
47
+	public function filter_control_args($args, $wp_customize) {
48
+		if ($args['settings'] === $this->args['settings']) {
49
+			$args         = parent::filter_control_args($args, $wp_customize);
50 50
 			$args['type'] = 'kirki-radio-image';
51 51
 		}
52 52
 		return $args;
Please login to merge, or discard this patch.
kirki-4.0.24/packages/kirki-framework/control-radio/src/Field/Radio.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -55,15 +55,15 @@  discard block
 block discarded – undo
55 55
 	 * @param WP_Customize_Manager $wp_customize The customizer instance.
56 56
 	 * @return array
57 57
 	 */
58
-	public function filter_setting_args( $args, $wp_customize ) {
59
-		if ( $args['settings'] === $this->args['settings'] ) {
60
-			$args = parent::filter_setting_args( $args, $wp_customize );
58
+	public function filter_setting_args($args, $wp_customize) {
59
+		if ($args['settings'] === $this->args['settings']) {
60
+			$args = parent::filter_setting_args($args, $wp_customize);
61 61
 
62 62
 			// Set the sanitize-callback if none is defined.
63
-			if ( ! isset( $args['sanitize_callback'] ) || ! $args['sanitize_callback'] ) {
64
-				$args['sanitize_callback'] = function( $value ) {
65
-					if ( ! isset( $this->args['choices'][ $value ] ) ) {
66
-						return ( isset( $this->args['default'] ) ) ? $this->args['default'] : '';
63
+			if (!isset($args['sanitize_callback']) || !$args['sanitize_callback']) {
64
+				$args['sanitize_callback'] = function($value) {
65
+					if (!isset($this->args['choices'][$value])) {
66
+						return (isset($this->args['default'])) ? $this->args['default'] : '';
67 67
 					}
68 68
 					return $value;
69 69
 				};
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 	 * @param WP_Customize_Manager $wp_customize The customizer instance.
82 82
 	 * @return array
83 83
 	 */
84
-	public function filter_control_args( $args, $wp_customize ) {
85
-		if ( $args['settings'] === $this->args['settings'] ) {
86
-			$args         = parent::filter_control_args( $args, $wp_customize );
84
+	public function filter_control_args($args, $wp_customize) {
85
+		if ($args['settings'] === $this->args['settings']) {
86
+			$args         = parent::filter_control_args($args, $wp_customize);
87 87
 			$args['type'] = 'kirki-radio';
88 88
 		}
89 89
 		return $args;
Please login to merge, or discard this patch.
packages/kirki-framework/control-radio/src/Control/Radio_Buttonset.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@
 block discarded – undo
41 41
 		parent::enqueue();
42 42
 
43 43
 		// Enqueue the script.
44
-		wp_enqueue_script( 'kirki-control-radio', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'jquery', 'customize-base', 'kirki-control-base' ], Radio::$control_ver, false );
44
+		wp_enqueue_script('kirki-control-radio', URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.js'), ['jquery', 'customize-base', 'kirki-control-base'], Radio::$control_ver, false);
45 45
 
46 46
 		// Enqueue the style.
47
-		wp_enqueue_style( 'kirki-control-radio-style', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], Radio::$control_ver );
47
+		wp_enqueue_style('kirki-control-radio-style', URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.css'), [], Radio::$control_ver);
48 48
 	}
49 49
 
50 50
 	/**
Please login to merge, or discard this patch.
packages/kirki-framework/control-radio/src/Control/Radio_Image.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 use Kirki\URL;
15 15
 
16 16
 // Exit if accessed directly.
17
-if ( ! defined( 'ABSPATH' ) ) {
17
+if (!defined('ABSPATH')) {
18 18
 	exit;
19 19
 }
20 20
 
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 		parent::enqueue();
41 41
 
42 42
 		// Enqueue the script.
43
-		wp_enqueue_script( 'kirki-control-radio', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'jquery', 'customize-base', 'kirki-control-base' ], Radio::$control_ver, false );
43
+		wp_enqueue_script('kirki-control-radio', URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.js'), ['jquery', 'customize-base', 'kirki-control-base'], Radio::$control_ver, false);
44 44
 
45 45
 		// Enqueue the style.
46
-		wp_enqueue_style( 'kirki-control-radio-style', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], Radio::$control_ver );
46
+		wp_enqueue_style('kirki-control-radio-style', URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.css'), [], Radio::$control_ver);
47 47
 	}
48 48
 
49 49
 	/**
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function to_json() {
59 59
 		parent::to_json();
60
-		foreach ( $this->input_attrs as $attr => $value ) {
61
-			if ( 'style' !== $attr ) {
62
-				$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
60
+		foreach ($this->input_attrs as $attr => $value) {
61
+			if ('style' !== $attr) {
62
+				$this->json['inputAttrs'] .= $attr . '="' . esc_attr($value) . '" ';
63 63
 				continue;
64 64
 			}
65
-			$this->json['labelStyle'] = 'style="' . esc_attr( $value ) . '" ';
65
+			$this->json['labelStyle'] = 'style="' . esc_attr($value) . '" ';
66 66
 		}
67 67
 	}
68 68
 
Please login to merge, or discard this patch.
kirki-4.0.24/packages/kirki-framework/control-radio/src/Control/Radio.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 use Kirki\URL;
15 15
 
16 16
 // Exit if accessed directly.
17
-if ( ! defined( 'ABSPATH' ) ) {
17
+if (!defined('ABSPATH')) {
18 18
 	exit;
19 19
 }
20 20
 
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 		parent::enqueue();
51 51
 
52 52
 		// Enqueue the script.
53
-		wp_enqueue_script( 'kirki-control-radio', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'jquery', 'customize-base', 'kirki-control-base' ], self::$control_ver, false );
53
+		wp_enqueue_script('kirki-control-radio', URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.js'), ['jquery', 'customize-base', 'kirki-control-base'], self::$control_ver, false);
54 54
 
55 55
 		// Enqueue the style.
56
-		wp_enqueue_style( 'kirki-control-radio-style', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], self::$control_ver );
56
+		wp_enqueue_style('kirki-control-radio-style', URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.css'), [], self::$control_ver);
57 57
 	}
58 58
 
59 59
 	/**
Please login to merge, or discard this patch.
kirki-4.0.24/packages/kirki-framework/control-palette/src/Field/Palette.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@
 block discarded – undo
44 44
 	 * @param WP_Customize_Manager $wp_customize The customizer instance.
45 45
 	 * @return array
46 46
 	 */
47
-	public function filter_control_args( $args, $wp_customize ) {
48
-		if ( $args['settings'] === $this->args['settings'] ) {
49
-			$args         = parent::filter_control_args( $args, $wp_customize );
47
+	public function filter_control_args($args, $wp_customize) {
48
+		if ($args['settings'] === $this->args['settings']) {
49
+			$args         = parent::filter_control_args($args, $wp_customize);
50 50
 			$args['type'] = 'kirki-palette';
51 51
 		}
52 52
 		return $args;
Please login to merge, or discard this patch.