Test Setup Failed
Push — master ( 3e6d69...55e7e9 )
by Aristeides
02:27
created
field/class-kirki-field-select.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
 
93 93
 		if ( is_array( $value ) ) {
94 94
 			foreach ( $value as $key => $subvalue ) {
95
-				if ( '' !== $subvalue || isset( $this->choices[''] ) ) {
95
+				if ( '' !== $subvalue || isset( $this->choices[ '' ] ) ) {
96 96
 					$key           = sanitize_key( $key );
97 97
 					$value[ $key ] = esc_attr( $subvalue );
98 98
 				}
Please login to merge, or discard this patch.
field/class-kirki-field-spacing.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,10 +68,10 @@
 block discarded – undo
68 68
 
69 69
 		$default_args = array(
70 70
 			'controls' => array(
71
-				'top'    => ( isset( $this->default['top'] ) ),
72
-				'bottom' => ( isset( $this->default['top'] ) ),
73
-				'left'   => ( isset( $this->default['top'] ) ),
74
-				'right'  => ( isset( $this->default['top'] ) ),
71
+				'top'    => ( isset( $this->default[ 'top' ] ) ),
72
+				'bottom' => ( isset( $this->default[ 'top' ] ) ),
73
+				'left'   => ( isset( $this->default[ 'top' ] ) ),
74
+				'right'  => ( isset( $this->default[ 'top' ] ) ),
75 75
 			),
76 76
 			'labels'   => array(
77 77
 				'top'    => esc_attr__( 'Top', 'kirki' ),
Please login to merge, or discard this patch.
field/class-kirki-field-typography.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -49,18 +49,18 @@  discard block
 block discarded – undo
49 49
 	protected function set_default() {
50 50
 
51 51
 		// Accomodate the use of font-weight and convert to variant.
52
-		if ( isset( $this->default['font-weight'] ) ) {
53
-			$this->default['variant'] = ( 'regular' === $this->default['font-weight'] ) ? 400 : (string) intval( $this->default['font-weight'] );
52
+		if ( isset( $this->default[ 'font-weight' ] ) ) {
53
+			$this->default[ 'variant' ] = ( 'regular' === $this->default[ 'font-weight' ] ) ? 400 : (string) intval( $this->default[ 'font-weight' ] );
54 54
 		}
55 55
 
56 56
 		// Make sure letter-spacing has units.
57
-		if ( isset( $this->default['letter-spacing'] ) && is_numeric( $this->default['letter-spacing'] ) && $this->default['letter-spacing'] ) {
58
-			$this->default['letter-spacing'] .= 'px';
57
+		if ( isset( $this->default[ 'letter-spacing' ] ) && is_numeric( $this->default[ 'letter-spacing' ] ) && $this->default[ 'letter-spacing' ] ) {
58
+			$this->default[ 'letter-spacing' ] .= 'px';
59 59
 		}
60 60
 
61 61
 		// Make sure we use "subsets" instead of "subset".
62
-		if ( isset( $this->default['subset'] ) && ! empty( $this->default['subset'] ) && ( ! isset( $this->default['subsets'] ) || empty( $this->default['subsets'] ) ) ) {
63
-			$this->default['subsets'] = $this->default['subset'];
62
+		if ( isset( $this->default[ 'subset' ] ) && ! empty( $this->default[ 'subset' ] ) && ( ! isset( $this->default[ 'subsets' ] ) || empty( $this->default[ 'subsets' ] ) ) ) {
63
+			$this->default[ 'subsets' ] = $this->default[ 'subset' ];
64 64
 		}
65 65
 	}
66 66
 
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
 			foreach ( $this->output as $output ) {
112 112
 
113 113
 				// If 'element' or 'property' are not defined, skip this.
114
-				if ( ! isset( $output['element'] ) ) {
114
+				if ( ! isset( $output[ 'element' ] ) ) {
115 115
 					continue;
116 116
 				}
117
-				if ( is_array( $output['element'] ) ) {
118
-					$output['element'] = implode( ',', $output['element'] );
117
+				if ( is_array( $output[ 'element' ] ) ) {
118
+					$output[ 'element' ] = implode( ',', $output[ 'element' ] );
119 119
 				}
120 120
 
121 121
 				// If we got this far, it's safe to add this.
122
-				$js_vars[] = $output;
122
+				$js_vars[ ] = $output;
123 123
 			}
124 124
 
125 125
 			// Did we manage to get all the items from 'output'?
@@ -151,45 +151,45 @@  discard block
 block discarded – undo
151 151
 		foreach ( $value as $key => $val ) {
152 152
 			switch ( $key ) {
153 153
 				case 'font-family':
154
-					$value['font-family'] = esc_attr( $val );
154
+					$value[ 'font-family' ] = esc_attr( $val );
155 155
 					break;
156 156
 				case 'font-weight':
157
-					if ( isset( $value['variant'] ) ) {
157
+					if ( isset( $value[ 'variant' ] ) ) {
158 158
 						break;
159 159
 					}
160
-					$value['variant'] = $val;
161
-					if ( isset( $value['font-style'] ) && 'italic' === $value['font-style'] ) {
162
-						$value['variant'] = ( '400' !== $val || 400 !== $val ) ? $value['variant'] . 'italic' : 'italic';
160
+					$value[ 'variant' ] = $val;
161
+					if ( isset( $value[ 'font-style' ] ) && 'italic' === $value[ 'font-style' ] ) {
162
+						$value[ 'variant' ] = ( '400' !== $val || 400 !== $val ) ? $value[ 'variant' ] . 'italic' : 'italic';
163 163
 					}
164 164
 					break;
165 165
 				case 'variant':
166 166
 					// Use 'regular' instead of 400 for font-variant.
167
-					$value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val;
167
+					$value[ 'variant' ] = ( 400 === $val || '400' === $val ) ? 'regular' : $val;
168 168
 					// Get font-weight from variant.
169
-					$value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
170
-					$value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? 400 : absint( $value['font-weight'] );
169
+					$value[ 'font-weight' ] = filter_var( $value[ 'variant' ], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
170
+					$value[ 'font-weight' ] = ( 'regular' === $value[ 'variant' ] || 'italic' === $value[ 'variant' ] ) ? 400 : absint( $value[ 'font-weight' ] );
171 171
 					// Get font-style from variant.
172
-					if ( ! isset( $value['font-style'] ) ) {
173
-						$value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic';
172
+					if ( ! isset( $value[ 'font-style' ] ) ) {
173
+						$value[ 'font-style' ] = ( false === strpos( $value[ 'variant' ], 'italic' ) ) ? 'normal' : 'italic';
174 174
 					}
175 175
 					break;
176 176
 				case 'subset':
177 177
 					// Make sure the saved value is "subsets" (plural) and not "subset".
178 178
 					// This is for compatibility with older versions.
179
-					if ( ! empty( $value['subset'] ) && ! isset( $value['subsets'] ) || empty( $value['subset'] ) ) {
180
-						$value['subsets'] = $value['subset'];
179
+					if ( ! empty( $value[ 'subset' ] ) && ! isset( $value[ 'subsets' ] ) || empty( $value[ 'subset' ] ) ) {
180
+						$value[ 'subsets' ] = $value[ 'subset' ];
181 181
 					}
182
-					unset( $value['subset'] );
182
+					unset( $value[ 'subset' ] );
183 183
 					// Make sure we're using a valid subset.
184 184
 					$valid_subsets    = Kirki_Fonts::get_google_font_subsets();
185 185
 					$subsets_ok       = array();
186
-					$value['subsets'] = (array) $value['subsets'];
187
-					foreach ( $value['subsets'] as $subset ) {
186
+					$value[ 'subsets' ] = (array) $value[ 'subsets' ];
187
+					foreach ( $value[ 'subsets' ] as $subset ) {
188 188
 						if ( array_key_exists( $subset, $valid_subsets ) ) {
189
-							$subsets_ok[] = $subset;
189
+							$subsets_ok[ ] = $subset;
190 190
 						}
191 191
 					}
192
-					$value['subsets'] = $subsets_ok;
192
+					$value[ 'subsets' ] = $subsets_ok;
193 193
 					break;
194 194
 				case 'font-size':
195 195
 				case 'letter-spacing':
@@ -199,21 +199,21 @@  discard block
 block discarded – undo
199 199
 					break;
200 200
 				case 'text-align':
201 201
 					if ( ! in_array( $val, array( 'inherit', 'left', 'center', 'right', 'justify' ), true ) ) {
202
-						$value['text-align'] = 'inherit';
202
+						$value[ 'text-align' ] = 'inherit';
203 203
 					}
204 204
 					break;
205 205
 				case 'text-transform':
206 206
 					if ( ! in_array( $val, array( 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ), true ) ) {
207
-						$value['text-transform'] = 'none';
207
+						$value[ 'text-transform' ] = 'none';
208 208
 					}
209 209
 					break;
210 210
 				case 'text-decoration':
211 211
 					if ( ! in_array( $val, array( 'none', 'underline', 'overline', 'line-through', 'initial', 'inherit' ), true ) ) {
212
-						$value['text-transform'] = 'none';
212
+						$value[ 'text-transform' ] = 'none';
213 213
 					}
214 214
 					break;
215 215
 				case 'color':
216
-					$value['color'] = ariColor::newColor( $val )->toCSS( 'hex' );
216
+					$value[ 'color' ] = ariColor::newColor( $val )->toCSS( 'hex' );
217 217
 					break;
218 218
 			} // End switch().
219 219
 		} // End foreach().
Please login to merge, or discard this patch.
kirki.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 		include_once ABSPATH . 'wp-admin/includes/plugin.php';
44 44
 	}
45 45
 	$data    = get_plugin_data( KIRKI_PLUGIN_FILE );
46
-	$version = ( isset( $data['Version'] ) ) ? $data['Version'] : false;
46
+	$version = ( isset( $data[ 'Version' ] ) ) ? $data[ 'Version' ] : false;
47 47
 	define( 'KIRKI_VERSION', $version );
48 48
 }
49 49
 
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.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 		$config                             = Kirki_Config::get_instance( $config_id, $args );
146 146
 		$config_args                        = $config->get_config();
147
-		self::$config[ $config_args['id'] ] = $config_args;
147
+		self::$config[ $config_args[ 'id' ] ] = $config_args;
148 148
 	}
149 149
 
150 150
 	/**
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public static function add_panel( $id = '', $args = array() ) {
159 159
 
160
-		$args['id']          = esc_attr( $id );
161
-		$args['description'] = ( isset( $args['description'] ) ) ? esc_textarea( $args['description'] ) : '';
162
-		$args['priority']    = ( isset( $args['priority'] ) ) ? esc_attr( $args['priority'] ) : 10;
163
-		$args['type']        = ( isset( $args['type'] ) ) ? $args['type'] : 'default';
164
-		$args['type']        = 'kirki-' . $args['type'];
160
+		$args[ 'id' ]          = esc_attr( $id );
161
+		$args[ 'description' ] = ( isset( $args[ 'description' ] ) ) ? esc_textarea( $args[ 'description' ] ) : '';
162
+		$args[ 'priority' ]    = ( isset( $args[ 'priority' ] ) ) ? esc_attr( $args[ 'priority' ] ) : 10;
163
+		$args[ 'type' ]        = ( isset( $args[ 'type' ] ) ) ? $args[ 'type' ] : 'default';
164
+		$args[ 'type' ]        = 'kirki-' . $args[ 'type' ];
165 165
 
166
-		self::$panels[ $args['id'] ] = $args;
166
+		self::$panels[ $args[ 'id' ] ] = $args;
167 167
 	}
168 168
 
169 169
 	/**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public static function remove_panel( $id = '' ) {
178 178
 		if ( ! in_array( $id, self::$panels_to_remove, true ) ) {
179
-			self::$panels_to_remove[] = $id;
179
+			self::$panels_to_remove[ ] = $id;
180 180
 		}
181 181
 	}
182 182
 
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public static function add_section( $id, $args ) {
192 192
 
193
-		$args['id']          = esc_attr( $id );
194
-		$args['panel']       = ( isset( $args['panel'] ) ) ? esc_attr( $args['panel'] ) : '';
195
-		$args['description'] = ( isset( $args['description'] ) ) ? esc_textarea( $args['description'] ) : '';
196
-		$args['priority']    = ( isset( $args['priority'] ) ) ? esc_attr( $args['priority'] ) : 10;
197
-		$args['type']        = ( isset( $args['type'] ) ) ? $args['type'] : 'default';
198
-		$args['type']        = 'kirki-' . $args['type'];
193
+		$args[ 'id' ]          = esc_attr( $id );
194
+		$args[ 'panel' ]       = ( isset( $args[ 'panel' ] ) ) ? esc_attr( $args[ 'panel' ] ) : '';
195
+		$args[ 'description' ] = ( isset( $args[ 'description' ] ) ) ? esc_textarea( $args[ 'description' ] ) : '';
196
+		$args[ 'priority' ]    = ( isset( $args[ 'priority' ] ) ) ? esc_attr( $args[ 'priority' ] ) : 10;
197
+		$args[ 'type' ]        = ( isset( $args[ 'type' ] ) ) ? $args[ 'type' ] : 'default';
198
+		$args[ 'type' ]        = 'kirki-' . $args[ 'type' ];
199 199
 
200
-		self::$sections[ $args['id'] ] = $args;
200
+		self::$sections[ $args[ 'id' ] ] = $args;
201 201
 	}
202 202
 
203 203
 	/**
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public static function remove_section( $id = '' ) {
212 212
 		if ( ! in_array( $id, self::$sections_to_remove, true ) ) {
213
-			self::$sections_to_remove[] = $id;
213
+			self::$sections_to_remove[ ] = $id;
214 214
 		}
215 215
 	}
216 216
 
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
 		}
230 230
 
231 231
 		// Early exit if 'type' is not defined.
232
-		if ( ! isset( $args['type'] ) ) {
232
+		if ( ! isset( $args[ 'type' ] ) ) {
233 233
 			return;
234 234
 		}
235 235
 
236
-		$str       = str_replace( array( '-', '_' ), ' ', $args['type'] );
236
+		$str       = str_replace( array( '-', '_' ), ' ', $args[ 'type' ] );
237 237
 		$classname = 'Kirki_Field_' . str_replace( ' ', '_', ucwords( $str ) );
238 238
 		if ( class_exists( $classname ) ) {
239 239
 			new $classname( $config_id, $args );
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public static function remove_control( $id ) {
263 263
 		if ( ! in_array( $id, self::$controls_to_remove, true ) ) {
264
-			self::$controls_to_remove[] = $id;
264
+			self::$controls_to_remove[ ] = $id;
265 265
 		}
266 266
 	}
267 267
 
Please login to merge, or discard this patch.
core/class-kirki-helper.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -385,7 +385,8 @@
 block discarded – undo
385 385
 			$return = true;
386 386
 		} elseif ( '!==' === $operator && $value1 !== $value2 ) {
387 387
 			$return = true;
388
-		} elseif ( ( '!=' === $operator || 'not equal' === $operator ) && $value1 != $value2 ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
388
+		} elseif ( ( '!=' === $operator || 'not equal' === $operator ) && $value1 != $value2 ) {
389
+// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
389 390
 			$return = true;
390 391
 		} elseif ( ( '>=' === $operator || 'greater or equal' === $operator || 'equal or greater' === $operator ) && $value2 >= $value1 ) {
391 392
 			$return = true;
Please login to merge, or discard this patch.
core/class-kirki-values.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function typography_field_tweaks( $value, $field_id ) {
42 42
 
43
-		if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['type'] ) ) {
44
-			if ( 'kirki-typography' === Kirki::$fields[ $field_id ]['type'] ) {
43
+		if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'type' ] ) ) {
44
+			if ( 'kirki-typography' === Kirki::$fields[ $field_id ][ 'type' ] ) {
45 45
 
46 46
 				// Sanitize the value.
47 47
 				// This also adds font-weight if it doesn't already exist.
48 48
 				$value = Kirki_Field_Typography::sanitize( $value );
49 49
 
50 50
 				// Combine font-family and font-backup.
51
-				if ( isset( $value['font-family'] ) && isset( $value['font-backup'] ) ) {
52
-					$value['font-family'] .= ', ' . $value['font-backup'];
53
-					unset( $value['font-backup'] );
51
+				if ( isset( $value[ 'font-family' ] ) && isset( $value[ 'font-backup' ] ) ) {
52
+					$value[ 'font-family' ] .= ', ' . $value[ 'font-backup' ];
53
+					unset( $value[ 'font-backup' ] );
54 54
 				}
55 55
 			}
56 56
 		}
@@ -87,39 +87,39 @@  discard block
 block discarded – undo
87 87
 			$config_id = 'global';
88 88
 		}
89 89
 
90
-		if ( 'theme_mod' === Kirki::$config[ $config_id ]['option_type'] ) {
90
+		if ( 'theme_mod' === Kirki::$config[ $config_id ][ 'option_type' ] ) {
91 91
 
92 92
 			// We're using theme_mods so just get the value using get_theme_mod.
93 93
 			$default_value = null;
94
-			if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) {
95
-				$default_value = Kirki::$fields[ $field_id ]['default'];
94
+			if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'default' ] ) ) {
95
+				$default_value = Kirki::$fields[ $field_id ][ 'default' ];
96 96
 			}
97 97
 			$value = get_theme_mod( $field_id, $default_value );
98 98
 			return apply_filters( 'kirki/values/get_value', $value, $field_id );
99 99
 		}
100 100
 
101
-		if ( 'option' === Kirki::$config[ $config_id ]['option_type'] ) {
101
+		if ( 'option' === Kirki::$config[ $config_id ][ 'option_type' ] ) {
102 102
 
103 103
 			// We're using options.
104
-			if ( '' !== Kirki::$config[ $config_id ]['option_name'] ) {
104
+			if ( '' !== Kirki::$config[ $config_id ][ 'option_name' ] ) {
105 105
 
106 106
 				// Options are serialized as a single option in the db.
107 107
 				// We'll have to get the option and then get the item from the array.
108
-				$options = get_option( Kirki::$config[ $config_id ]['option_name'] );
108
+				$options = get_option( Kirki::$config[ $config_id ][ 'option_name' ] );
109 109
 
110
-				if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) {
111
-					$field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']';
110
+				if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ][ 'option_name' ] . '[' . $field_id . ']' ] ) ) {
111
+					$field_id = Kirki::$config[ $config_id ][ 'option_name' ] . '[' . $field_id . ']';
112 112
 				}
113
-				$setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) );
113
+				$setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ][ 'option_name' ] . '[', '', $field_id ) );
114 114
 
115
-				$default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) ? Kirki::$fields[ $field_id ]['default'] : '';
115
+				$default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'default' ] ) ) ? Kirki::$fields[ $field_id ][ 'default' ] : '';
116 116
 				$value         = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : $default_value;
117 117
 				$value         = maybe_unserialize( $value );
118 118
 				return apply_filters( 'kirki/values/get_value', $value, $field_id );
119 119
 			}
120 120
 
121 121
 			// Each option separately saved in the db.
122
-			$value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] );
122
+			$value = get_option( $field_id, Kirki::$fields[ $field_id ][ 'default' ] );
123 123
 			return apply_filters( 'kirki/values/get_value', $value, $field_id );
124 124
 
125 125
 		} // End if().
@@ -137,18 +137,18 @@  discard block
 block discarded – undo
137 137
 	 * @return string|array
138 138
 	 */
139 139
 	public static function get_sanitized_field_value( $field ) {
140
-		$value = $field['default'];
141
-		if ( isset( $field['option_type'] ) && 'theme_mod' === $field['option_type'] ) {
142
-			$value = get_theme_mod( $field['settings'], $field['default'] );
143
-		} elseif ( isset( $field['option_type'] ) && 'option' === $field['option_type'] ) {
144
-			if ( isset( $field['option_name'] ) && '' !== $field['option_name'] ) {
145
-				$all_values     = get_option( $field['option_name'], array() );
146
-				$sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] );
140
+		$value = $field[ 'default' ];
141
+		if ( isset( $field[ 'option_type' ] ) && 'theme_mod' === $field[ 'option_type' ] ) {
142
+			$value = get_theme_mod( $field[ 'settings' ], $field[ 'default' ] );
143
+		} elseif ( isset( $field[ 'option_type' ] ) && 'option' === $field[ 'option_type' ] ) {
144
+			if ( isset( $field[ 'option_name' ] ) && '' !== $field[ 'option_name' ] ) {
145
+				$all_values     = get_option( $field[ 'option_name' ], array() );
146
+				$sub_setting_id = str_replace( array( ']', $field[ 'option_name' ] . '[' ), '', $field[ 'settings' ] );
147 147
 				if ( isset( $all_values[ $sub_setting_id ] ) ) {
148 148
 					$value = $all_values[ $sub_setting_id ];
149 149
 				}
150 150
 			} else {
151
-				$value = get_option( $field['settings'], $field['default'] );
151
+				$value = get_option( $field[ 'settings' ], $field[ 'default' ] );
152 152
 			}
153 153
 		}
154 154
 
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.