Test Setup Failed
Pull Request — master (#1710)
by Aristeides
02:23
created
core/class-kirki-l10n.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@
 block discarded – undo
119 119
 		global $l10n;
120 120
 		if ( isset( $l10n[ $this->get_theme_textdomain() ] ) ) {
121 121
 			// @codingStandardsIgnoreLine WordPress.Variables.GlobalVariables.OverrideProhibited
122
-			$l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ];
122
+			$l10n[ 'kirki' ] = $l10n[ $this->get_theme_textdomain() ];
123 123
 		}
124 124
 
125 125
 		// Check if the domain is "kirki".
Please login to merge, or discard this patch.
core/class-kirki-field.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -227,28 +227,28 @@  discard block
 block discarded – undo
227 227
 	 */
228 228
 	public function __construct( $config_id = 'global', $args = array() ) {
229 229
 
230
-		if ( isset( $args['setting'] ) && ! empty( $args['setting'] ) && ( ! isset( $args['settings'] ) || empty( $args['settings'] ) ) ) {
230
+		if ( isset( $args[ 'setting' ] ) && ! empty( $args[ 'setting' ] ) && ( ! isset( $args[ 'settings' ] ) || empty( $args[ 'settings' ] ) ) ) {
231 231
 			/* translators: %s represents the field ID where the error occurs. */
232
-			_doing_it_wrong( __METHOD__, sprintf( esc_attr__( 'Typo found in field %s - setting instead of settings.', 'kirki' ), esc_attr( $args['settings'] ) ), '3.0.10' );
233
-			$args['settings'] = $args['setting'];
234
-			unset( $args['setting'] );
232
+			_doing_it_wrong( __METHOD__, sprintf( esc_attr__( 'Typo found in field %s - setting instead of settings.', 'kirki' ), esc_attr( $args[ 'settings' ] ) ), '3.0.10' );
233
+			$args[ 'settings' ] = $args[ 'setting' ];
234
+			unset( $args[ 'setting' ] );
235 235
 		}
236 236
 
237 237
 		// In case the user only provides 1 argument,
238 238
 		// assume that the provided argument is $args and set $config_id = 'global'.
239 239
 		if ( is_array( $config_id ) && empty( $args ) ) {
240 240
 			/* translators: %1$s represents the field ID where the error occurs. %2$s is the URL in the documentation site. */
241
-			_doing_it_wrong( __METHOD__, sprintf( esc_attr__( 'Config not defined for field %1$s - See %2$s for details on how to properly add fields.', 'kirki' ), esc_attr( $args['settings'] ), 'https://aristath.github.io/kirki/docs/getting-started/fields.html' ), '3.0.10' );
241
+			_doing_it_wrong( __METHOD__, sprintf( esc_attr__( 'Config not defined for field %1$s - See %2$s for details on how to properly add fields.', 'kirki' ), esc_attr( $args[ 'settings' ] ), 'https://aristath.github.io/kirki/docs/getting-started/fields.html' ), '3.0.10' );
242 242
 			$args = $config_id;
243 243
 			$config_id = 'global';
244 244
 		}
245 245
 
246
-		$args['kirki_config'] = $config_id;
246
+		$args[ 'kirki_config' ] = $config_id;
247 247
 
248 248
 		$this->kirki_config = trim( esc_attr( $config_id ) );
249 249
 		if ( '' === $config_id ) {
250 250
 			/* translators: %1$s represents the field ID where the error occurs. %2$s is the URL in the documentation site. */
251
-			_doing_it_wrong( __METHOD__, sprintf( esc_attr__( 'Config not defined for field %1$s - See %2$s for details on how to properly add fields.', 'kirki' ), esc_attr( $args['settings'] ), 'https://aristath.github.io/kirki/docs/getting-started/fields.html' ), '3.0.10' );
251
+			_doing_it_wrong( __METHOD__, sprintf( esc_attr__( 'Config not defined for field %1$s - See %2$s for details on how to properly add fields.', 'kirki' ), esc_attr( $args[ 'settings' ] ), 'https://aristath.github.io/kirki/docs/getting-started/fields.html' ), '3.0.10' );
252 252
 			$this->kirki_config = 'global';
253 253
 		}
254 254
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		$defaults = get_class_vars( __CLASS__ );
257 257
 
258 258
 		// Get the config arguments, and merge them with the defaults.
259
-		$config_defaults = ( isset( Kirki::$config['global'] ) ) ? Kirki::$config['global'] : array();
259
+		$config_defaults = ( isset( Kirki::$config[ 'global' ] ) ) ? Kirki::$config[ 'global' ] : array();
260 260
 		if ( 'global' !== $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) {
261 261
 			$config_defaults = Kirki::$config[ $this->kirki_config ];
262 262
 		}
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 			$this->partial_refresh = array();
405 405
 		}
406 406
 		foreach ( $this->partial_refresh as $id => $args ) {
407
-			if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) {
407
+			if ( ! is_array( $args ) || ! isset( $args[ 'selector' ] ) || ! isset( $args[ 'render_callback' ] ) || ! is_callable( $args[ 'render_callback' ] ) ) {
408 408
 				/* translators: %1$s represents the field ID where the error occurs. */
409 409
 				_doing_it_wrong( __METHOD__, sprintf( esc_attr__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_attr( $this->settings ) ), '3.0.10' );
410 410
 				unset( $this->partial_refresh[ $id ] );
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
 			}
443 443
 		}
444 444
 		$this->settings = $settings;
445
-		if ( isset( $this->settings['kirki_placeholder_setting'] ) ) {
446
-			$this->settings = $this->settings['kirki_placeholder_setting'];
445
+		if ( isset( $this->settings[ 'kirki_placeholder_setting' ] ) ) {
446
+			$this->settings = $this->settings[ 'kirki_placeholder_setting' ];
447 447
 		}
448 448
 	}
449 449
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	protected function set_active_callback() {
458 458
 
459 459
 		if ( is_array( $this->active_callback ) && ! is_callable( $this->active_callback ) ) {
460
-			if ( isset( $this->active_callback[0] ) ) {
460
+			if ( isset( $this->active_callback[ 0 ] ) ) {
461 461
 				$this->required = $this->active_callback;
462 462
 			}
463 463
 		}
@@ -543,34 +543,34 @@  discard block
 block discarded – undo
543 543
 			);
544 544
 		}
545 545
 		// Convert to array of arrays if needed.
546
-		if ( isset( $this->output['element'] ) ) {
546
+		if ( isset( $this->output[ 'element' ] ) ) {
547 547
 			/* translators: The field ID where the error occurs. */
548 548
 			_doing_it_wrong( __METHOD__, sprintf( esc_attr__( '"output" invalid format in field %s. The "output" argument should be defined as an array of arrays.', 'kirki' ), esc_attr( $this->settings ) ), '3.0.10' );
549 549
 			$this->output = array( $this->output );
550 550
 		}
551 551
 		foreach ( $this->output as $key => $output ) {
552
-			if ( empty( $output ) || ! isset( $output['element'] ) ) {
552
+			if ( empty( $output ) || ! isset( $output[ 'element' ] ) ) {
553 553
 				unset( $this->output[ $key ] );
554 554
 				continue;
555 555
 			}
556
-			if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) {
557
-				$this->output[ $key ]['sanitize_callback'] = $output['callback'];
556
+			if ( ! isset( $output[ 'sanitize_callback' ] ) && isset( $output[ 'callback' ] ) ) {
557
+				$this->output[ $key ][ 'sanitize_callback' ] = $output[ 'callback' ];
558 558
 			}
559 559
 			// Convert element arrays to strings.
560
-			if ( isset( $output['element'] ) && is_array( $output['element'] ) ) {
561
-				$this->output[ $key ]['element'] = array_unique( $this->output[ $key ]['element'] );
562
-				sort( $this->output[ $key ]['element'] );
560
+			if ( isset( $output[ 'element' ] ) && is_array( $output[ 'element' ] ) ) {
561
+				$this->output[ $key ][ 'element' ] = array_unique( $this->output[ $key ][ 'element' ] );
562
+				sort( $this->output[ $key ][ 'element' ] );
563 563
 
564 564
 				// Trim each element in the array.
565
-				foreach ( $this->output[ $key ]['element'] as $index => $element ) {
566
-					$this->output[ $key ]['element'][ $index ] = trim( $element );
565
+				foreach ( $this->output[ $key ][ 'element' ] as $index => $element ) {
566
+					$this->output[ $key ][ 'element' ][ $index ] = trim( $element );
567 567
 				}
568
-				$this->output[ $key ]['element'] = implode( ',', $this->output[ $key ]['element'] );
568
+				$this->output[ $key ][ 'element' ] = implode( ',', $this->output[ $key ][ 'element' ] );
569 569
 			}
570 570
 
571 571
 			// Fix for https://github.com/aristath/kirki/issues/1659#issuecomment-346229751.
572
-			$this->output[ $key ]['element'] = str_replace( array( "\t", "\n", "\r", "\0", "\x0B" ), ' ', $this->output[ $key ]['element'] );
573
-			$this->output[ $key ]['element'] = trim( preg_replace( '/\s+/', ' ', $this->output[ $key ]['element'] ) );
572
+			$this->output[ $key ][ 'element' ] = str_replace( array( "\t", "\n", "\r", "\0", "\x0B" ), ' ', $this->output[ $key ][ 'element' ] );
573
+			$this->output[ $key ][ 'element' ] = trim( preg_replace( '/\s+/', ' ', $this->output[ $key ][ 'element' ] ) );
574 574
 		}
575 575
 	}
576 576
 
@@ -603,23 +603,23 @@  discard block
 block discarded – undo
603 603
 
604 604
 			// Start going through each item in the $output array.
605 605
 			foreach ( $this->output as $output ) {
606
-				$output['function'] = ( isset( $output['function'] ) ) ? $output['function'] : 'style';
606
+				$output[ 'function' ] = ( isset( $output[ 'function' ] ) ) ? $output[ 'function' ] : 'style';
607 607
 
608 608
 				// If 'element' or 'property' are not defined, skip this.
609
-				if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) {
609
+				if ( ! isset( $output[ 'element' ] ) || ! isset( $output[ 'property' ] ) ) {
610 610
 					continue;
611 611
 				}
612
-				if ( is_array( $output['element'] ) ) {
613
-					$output['element'] = implode( ',', $output['element'] );
612
+				if ( is_array( $output[ 'element' ] ) ) {
613
+					$output[ 'element' ] = implode( ',', $output[ 'element' ] );
614 614
 				}
615 615
 
616 616
 				// If there's a sanitize_callback defined skip this, unless we also have a js_callback defined.
617
-				if ( isset( $output['sanitize_callback'] ) && ! empty( $output['sanitize_callback'] ) && ! isset( $output['js_callback'] ) ) {
617
+				if ( isset( $output[ 'sanitize_callback' ] ) && ! empty( $output[ 'sanitize_callback' ] ) && ! isset( $output[ 'js_callback' ] ) ) {
618 618
 					continue;
619 619
 				}
620 620
 
621 621
 				// If we got this far, it's safe to add this.
622
-				$js_vars[] = $output;
622
+				$js_vars[ ] = $output;
623 623
 			}
624 624
 
625 625
 			// Did we manage to get all the items from 'output'?
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 			$variable = ( is_string( $this->variables ) && ! empty( $this->variables ) ) ? $this->variables : false;
645 645
 			$this->variables = array();
646 646
 			if ( $variable && empty( $this->variables ) ) {
647
-				$this->variables[0]['name'] = $variable;
647
+				$this->variables[ 0 ][ 'name' ] = $variable;
648 648
 			}
649 649
 		}
650 650
 	}
Please login to merge, or discard this patch.
core/class-kirki-config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,8 +92,8 @@
 block discarded – undo
92 92
 		// Get defaults from the class.
93 93
 		$defaults = get_class_vars( __CLASS__ );
94 94
 		// Skip what we don't need in this context.
95
-		unset( $defaults['config_final'] );
96
-		unset( $defaults['instances'] );
95
+		unset( $defaults[ 'config_final' ] );
96
+		unset( $defaults[ 'instances' ] );
97 97
 		// Apply any kirki/config global filters.
98 98
 		$defaults = apply_filters( 'kirki/config', $defaults );
99 99
 		// Merge our args with the defaults.
Please login to merge, or discard this patch.
core/class-kirki-helper.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 		// Handle the arguments, merge one by one.
38 38
 		$args  = func_get_args();
39
-		$array = $args[0];
39
+		$array = $args[ 0 ];
40 40
 		if ( ! is_array( $array ) ) {
41 41
 			return $array;
42 42
 		}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		}
113 113
 
114 114
 		if ( ! empty( $attachment ) ) {
115
-			return $attachment[0];
115
+			return $attachment[ 0 ];
116 116
 		}
117 117
 		return 0;
118 118
 	}
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 		$image    = wp_get_attachment_image_src( $image_id, 'full' );
130 130
 
131 131
 		return array(
132
-			'url'       => $image[0],
133
-			'width'     => $image[1],
134
-			'height'    => $image[2],
135
-			'thumbnail' => $image[3],
132
+			'url'       => $image[ 0 ],
133
+			'width'     => $image[ 1 ],
134
+			'height'    => $image[ 2 ],
135
+			'thumbnail' => $image[ 3 ],
136 136
 		);
137 137
 
138 138
 	}
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 					'suppress_filters' => false,
154 154
 				)
155 155
 			);
156
-		} elseif ( is_array( $args ) && ! isset( $args['suppress_filters'] ) ) {
157
-			$args['suppress_filters'] = false;
156
+		} elseif ( is_array( $args ) && ! isset( $args[ 'suppress_filters' ] ) ) {
157
+			$args[ 'suppress_filters' ] = false;
158 158
 		}
159 159
 
160 160
 		// Get the posts.
@@ -303,41 +303,41 @@  discard block
 block discarded – undo
303 303
 				$key = absint( $context ) / 100;
304 304
 				if ( 'A100' === $context ) {
305 305
 					$key = 10;
306
-					unset( $colors['grey'] );
306
+					unset( $colors[ 'grey' ] );
307 307
 				} elseif ( 'A200' === $context ) {
308 308
 					$key = 11;
309
-					unset( $colors['grey'] );
309
+					unset( $colors[ 'grey' ] );
310 310
 				} elseif ( 'A400' === $context ) {
311 311
 					$key = 12;
312
-					unset( $colors['grey'] );
312
+					unset( $colors[ 'grey' ] );
313 313
 				} elseif ( 'A700' === $context ) {
314 314
 					$key = 13;
315
-					unset( $colors['grey'] );
315
+					unset( $colors[ 'grey' ] );
316 316
 				}
317
-				unset( $colors['primary'] );
317
+				unset( $colors[ 'primary' ] );
318 318
 				$position_colors = array();
319 319
 				foreach ( $colors as $color_family ) {
320 320
 					if ( isset( $color_family[ $key ] ) ) {
321
-						$position_colors[] = $color_family[ $key ];
321
+						$position_colors[ ] = $color_family[ $key ];
322 322
 					}
323 323
 				}
324 324
 				return $position_colors;
325 325
 			case 'all':
326
-				unset( $colors['primary'] );
326
+				unset( $colors[ 'primary' ] );
327 327
 				$all_colors = array();
328 328
 				foreach ( $colors as $color_family ) {
329 329
 					foreach ( $color_family as $color ) {
330
-						$all_colors[] = $color;
330
+						$all_colors[ ] = $color;
331 331
 					}
332 332
 				}
333 333
 				return $all_colors;
334 334
 			case 'primary':
335
-				return $colors['primary'];
335
+				return $colors[ 'primary' ];
336 336
 			default:
337 337
 				if ( isset( $colors[ $context ] ) ) {
338 338
 					return $colors[ $context ];
339 339
 				}
340
-				return $colors['primary'];
340
+				return $colors[ 'primary' ];
341 341
 		} // End switch().
342 342
 	}
343 343
 
Please login to merge, or discard this patch.
core/class-kirki-modules.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
 	public static function add_module( $module ) {
105 105
 
106 106
 		if ( ! in_array( $module, self::$modules, true ) ) {
107
-			self::$modules[] = $module;
107
+			self::$modules[ ] = $module;
108 108
 		}
109 109
 
110 110
 	}
Please login to merge, or discard this patch.
core/class-kirki-panel.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@
 block discarded – undo
46 46
 	public function add_panel( $args ) {
47 47
 		global $wp_customize;
48 48
 
49
-		if ( ! isset( $args['type'] ) || ! array_key_exists( $args['type'], $this->panel_types ) ) {
50
-			$args['type'] = 'default';
49
+		if ( ! isset( $args[ 'type' ] ) || ! array_key_exists( $args[ 'type' ], $this->panel_types ) ) {
50
+			$args[ 'type' ] = 'default';
51 51
 		}
52
-		$panel_classname = $this->panel_types[ $args['type'] ];
52
+		$panel_classname = $this->panel_types[ $args[ 'type' ] ];
53 53
 
54
-		$wp_customize->add_panel( new $panel_classname( $wp_customize, sanitize_key( $args['id'] ), $args ) );
54
+		$wp_customize->add_panel( new $panel_classname( $wp_customize, sanitize_key( $args[ 'id' ] ), $args ) );
55 55
 
56 56
 	}
57 57
 }
Please login to merge, or discard this patch.
core/dynamic-css.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 // Echo the styles.
21 21
 $configs = Kirki::$config;
22 22
 foreach ( $configs as $config_id => $args ) {
23
-	if ( true === $args['disable_output'] ) {
23
+	if ( true === $args[ 'disable_output' ] ) {
24 24
 		continue;
25 25
 	}
26 26
 
Please login to merge, or discard this patch.
core/class-kirki-section.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,16 +49,16 @@
 block discarded – undo
49 49
 		// The default class to be used when creating a section.
50 50
 		$section_classname = 'WP_Customize_Section';
51 51
 
52
-		if ( isset( $args['type'] ) && array_key_exists( $args['type'], $this->section_types ) ) {
53
-			$section_classname = $this->section_types[ $args['type'] ];
52
+		if ( isset( $args[ 'type' ] ) && array_key_exists( $args[ 'type' ], $this->section_types ) ) {
53
+			$section_classname = $this->section_types[ $args[ 'type' ] ];
54 54
 		}
55
-		if ( isset( $args['type'] ) && 'kirki-outer' === $args['type'] ) {
56
-			$args['type'] = 'outer';
55
+		if ( isset( $args[ 'type' ] ) && 'kirki-outer' === $args[ 'type' ] ) {
56
+			$args[ 'type' ] = 'outer';
57 57
 			$section_classname = 'WP_Customize_Section';
58 58
 		}
59 59
 
60 60
 		// Add the section.
61
-		$wp_customize->add_section( new $section_classname( $wp_customize, sanitize_key( $args['id'] ), $args ) );
61
+		$wp_customize->add_section( new $section_classname( $wp_customize, sanitize_key( $args[ 'id' ] ), $args ) );
62 62
 
63 63
 	}
64 64
 }
Please login to merge, or discard this patch.
core/class-kirki-sections.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@
 block discarded – undo
36 36
 		$css = '';
37 37
 		if ( ! empty( Kirki::$sections ) ) {
38 38
 			foreach ( Kirki::$sections as $section_args ) {
39
-				if ( isset( $section_args['id'] ) && isset( $section_args['type'] ) && 'outer' === $section_args['type'] || 'kirki-outer' === $section_args['type'] ) {
40
-					$css .= '#customize-theme-controls li#accordion-section-' . $section_args['id'] . '{display:list-item!important;}';
39
+				if ( isset( $section_args[ 'id' ] ) && isset( $section_args[ 'type' ] ) && 'outer' === $section_args[ 'type' ] || 'kirki-outer' === $section_args[ 'type' ] ) {
40
+					$css .= '#customize-theme-controls li#accordion-section-' . $section_args[ 'id' ] . '{display:list-item!important;}';
41 41
 				}
42 42
 			}
43 43
 		}
Please login to merge, or discard this patch.