Completed
Pull Request — master (#1728)
by Aristeides
04:16 queued 02:07
created
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-init.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 
63 63
 		// Apply the kirki_config filter.
64 64
 		$config = apply_filters( 'kirki_config', array() );
65
-		if ( isset( $config['url_path'] ) ) {
66
-			Kirki::$url = $config['url_path'];
65
+		if ( isset( $config[ 'url_path' ] ) ) {
66
+			Kirki::$url = $config[ 'url_path' ];
67 67
 		}
68 68
 
69 69
 		// Make sure the right protocol is used.
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 		if ( ! empty( Kirki::$panels ) ) {
172 172
 			foreach ( Kirki::$panels as $panel_args ) {
173 173
 				// Extra checks for nested panels.
174
-				if ( isset( $panel_args['panel'] ) ) {
175
-					if ( isset( Kirki::$panels[ $panel_args['panel'] ] ) ) {
174
+				if ( isset( $panel_args[ 'panel' ] ) ) {
175
+					if ( isset( Kirki::$panels[ $panel_args[ 'panel' ] ] ) ) {
176 176
 						// Set the type to nested.
177
-						$panel_args['type'] = 'kirki-nested';
177
+						$panel_args[ 'type' ] = 'kirki-nested';
178 178
 					}
179 179
 				}
180 180
 
@@ -192,14 +192,14 @@  discard block
 block discarded – undo
192 192
 		if ( ! empty( Kirki::$sections ) ) {
193 193
 			foreach ( Kirki::$sections as $section_args ) {
194 194
 				// Extra checks for nested sections.
195
-				if ( isset( $section_args['section'] ) ) {
196
-					if ( isset( Kirki::$sections[ $section_args['section'] ] ) ) {
195
+				if ( isset( $section_args[ 'section' ] ) ) {
196
+					if ( isset( Kirki::$sections[ $section_args[ 'section' ] ] ) ) {
197 197
 						// Set the type to nested.
198
-						$section_args['type'] = 'kirki-nested';
198
+						$section_args[ 'type' ] = 'kirki-nested';
199 199
 						// We need to check if the parent section is nested inside a panel.
200
-						$parent_section = Kirki::$sections[ $section_args['section'] ];
201
-						if ( isset( $parent_section['panel'] ) ) {
202
-							$section_args['panel'] = $parent_section['panel'];
200
+						$parent_section = Kirki::$sections[ $section_args[ 'section' ] ];
201
+						if ( isset( $parent_section[ 'panel' ] ) ) {
202
+							$section_args[ 'panel' ] = $parent_section[ 'panel' ];
203 203
 						}
204 204
 					}
205 205
 				}
Please login to merge, or discard this patch.
core/class-kirki-config.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,8 +92,8 @@  discard block
 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.
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	public static function get_config_ids() {
162 162
 		$configs = array();
163 163
 		foreach ( self::$instances as $instance ) {
164
-			$configs[] = $instance->id;
164
+			$configs[ ] = $instance->id;
165 165
 		}
166 166
 		return array_unique( $configs );
167 167
 	}
Please login to merge, or discard this patch.
controls/php/class-kirki-control-repeater.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -76,28 +76,28 @@  discard block
 block discarded – undo
76 76
 
77 77
 		if ( empty( $this->button_label ) ) {
78 78
 			/* translators: %s represents the label of the row. */
79
-			$this->button_label = sprintf( esc_attr__( 'Add new %s', 'kirki' ), $this->row_label['value'] );
79
+			$this->button_label = sprintf( esc_attr__( 'Add new %s', 'kirki' ), $this->row_label[ 'value' ] );
80 80
 		}
81 81
 
82
-		if ( empty( $args['fields'] ) || ! is_array( $args['fields'] ) ) {
83
-			$args['fields'] = array();
82
+		if ( empty( $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) {
83
+			$args[ 'fields' ] = array();
84 84
 		}
85 85
 
86 86
 		// An array to store keys of fields that need to be filtered.
87 87
 		$media_fields_to_filter = array();
88 88
 
89
-		foreach ( $args['fields'] as $key => $value ) {
90
-			if ( ! isset( $value['default'] ) ) {
91
-				$args['fields'][ $key ]['default'] = '';
89
+		foreach ( $args[ 'fields' ] as $key => $value ) {
90
+			if ( ! isset( $value[ 'default' ] ) ) {
91
+				$args[ 'fields' ][ $key ][ 'default' ] = '';
92 92
 			}
93
-			if ( ! isset( $value['label'] ) ) {
94
-				$args['fields'][ $key ]['label'] = '';
93
+			if ( ! isset( $value[ 'label' ] ) ) {
94
+				$args[ 'fields' ][ $key ][ 'label' ] = '';
95 95
 			}
96
-			$args['fields'][ $key ]['id'] = $key;
96
+			$args[ 'fields' ][ $key ][ 'id' ] = $key;
97 97
 
98 98
 			// We check if the filed is an uploaded media ( image , file, video, etc.. ).
99
-			if ( isset( $value['type'] ) ) {
100
-				switch ( $value['type'] ) {
99
+			if ( isset( $value[ 'type' ] ) ) {
100
+				switch ( $value[ 'type' ] ) {
101 101
 					case 'image':
102 102
 					case 'cropped_image':
103 103
 					case 'upload':
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
 							)
118 118
 						);
119 119
 						// Hackily add in the data link parameter.
120
-						$dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][ $key ]['id'] ) . '"' . $this->get_link(), $dropdown );
121
-						$args['fields'][ $key ]['dropdown'] = $dropdown;
120
+						$dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args[ 'fields' ][ $key ][ 'id' ] ) . '"' . $this->get_link(), $dropdown );
121
+						$args[ 'fields' ][ $key ][ 'dropdown' ] = $dropdown;
122 122
 						break;
123 123
 				}
124 124
 			}
125 125
 		} // End foreach().
126 126
 
127
-		$this->fields = $args['fields'];
127
+		$this->fields = $args[ 'fields' ];
128 128
 
129 129
 		// Now we are going to filter the fields.
130 130
 		// First we create a copy of the value that would be used otherwise.
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
184 184
 
185 185
 		$fields = $this->fields;
186 186
 
187
-		$this->json['fields']    = $fields;
188
-		$this->json['row_label'] = $this->row_label;
187
+		$this->json[ 'fields' ]    = $fields;
188
+		$this->json[ 'row_label' ] = $this->row_label;
189 189
 
190 190
 		// If filtered_value has been set and is not empty we use it instead of the actual value.
191 191
 		if ( is_array( $this->filtered_value ) && ! empty( $this->filtered_value ) ) {
192
-			$this->json['value'] = $this->filtered_value;
192
+			$this->json[ 'value' ] = $this->filtered_value;
193 193
 		}
194
-		$this->json['value'] = apply_filters( "kirki_controls_repeater_value_{$this->id}", $this->json['value'] );
194
+		$this->json[ 'value' ] = apply_filters( "kirki_controls_repeater_value_{$this->id}", $this->json[ 'value' ] );
195 195
 	}
196 196
 
197 197
 	/**
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 
215 215
 		<ul class="repeater-fields"></ul>
216 216
 
217
-		<?php if ( isset( $this->choices['limit'] ) ) : ?>
217
+		<?php if ( isset( $this->choices[ 'limit' ] ) ) : ?>
218 218
 			<?php // @codingStandardsIgnoreLine ?>
219 219
 			<?php /* translators: %s represents the number of rows we're limiting the repeater to allow. */ ?>
220
-			<p class="limit"><?php printf( esc_attr__( 'Limit: %s rows', 'kirki' ), esc_html( $this->choices['limit'] ) ); ?></p>
220
+			<p class="limit"><?php printf( esc_attr__( 'Limit: %s rows', 'kirki' ), esc_html( $this->choices[ 'limit' ] ) ); ?></p>
221 221
 		<?php endif; ?>
222 222
 		<button class="button-secondary repeater-add"><?php echo esc_html( $this->button_label ); ?></button>
223 223
 
@@ -447,24 +447,24 @@  discard block
 block discarded – undo
447 447
 	protected function row_label( $args ) {
448 448
 
449 449
 		// Validating args for row labels.
450
-		if ( isset( $args['row_label'] ) && is_array( $args['row_label'] ) && ! empty( $args['row_label'] ) ) {
450
+		if ( isset( $args[ 'row_label' ] ) && is_array( $args[ 'row_label' ] ) && ! empty( $args[ 'row_label' ] ) ) {
451 451
 
452 452
 			// Validating row label type.
453
-			if ( isset( $args['row_label']['type'] ) && ( 'text' === $args['row_label']['type'] || 'field' === $args['row_label']['type'] ) ) {
454
-				$this->row_label['type'] = $args['row_label']['type'];
453
+			if ( isset( $args[ 'row_label' ][ 'type' ] ) && ( 'text' === $args[ 'row_label' ][ 'type' ] || 'field' === $args[ 'row_label' ][ 'type' ] ) ) {
454
+				$this->row_label[ 'type' ] = $args[ 'row_label' ][ 'type' ];
455 455
 			}
456 456
 
457 457
 			// Validating row label type.
458
-			if ( isset( $args['row_label']['value'] ) && ! empty( $args['row_label']['value'] ) ) {
459
-				$this->row_label['value'] = esc_attr( $args['row_label']['value'] );
458
+			if ( isset( $args[ 'row_label' ][ 'value' ] ) && ! empty( $args[ 'row_label' ][ 'value' ] ) ) {
459
+				$this->row_label[ 'value' ] = esc_attr( $args[ 'row_label' ][ 'value' ] );
460 460
 			}
461 461
 
462 462
 			// Validating row label field.
463
-			if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][ esc_attr( $args['row_label']['field'] ) ] ) ) {
464
-				$this->row_label['field'] = esc_attr( $args['row_label']['field'] );
463
+			if ( isset( $args[ 'row_label' ][ 'field' ] ) && ! empty( $args[ 'row_label' ][ 'field' ] ) && isset( $args[ 'fields' ][ esc_attr( $args[ 'row_label' ][ 'field' ] ) ] ) ) {
464
+				$this->row_label[ 'field' ] = esc_attr( $args[ 'row_label' ][ 'field' ] );
465 465
 			} else {
466 466
 				// If from field is not set correctly, making sure standard is set as the type.
467
-				$this->row_label['type'] = 'text';
467
+				$this->row_label[ 'type' ] = 'text';
468 468
 			}
469 469
 		}
470 470
 	}
Please login to merge, or discard this patch.
modules/customizer-styling/class-kirki-modules-customizer-styling.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 	public function custom_css() {
69 69
 
70 70
 		$config = apply_filters( 'kirki_config', array() );
71
-		if ( ! isset( $config['color_accent'] ) && ! isset( $config['color_back'] ) ) {
71
+		if ( ! isset( $config[ 'color_accent' ] ) && ! isset( $config[ 'color_back' ] ) ) {
72 72
 			return;
73 73
 		}
74
-		$back     = isset( $config['color_back'] ) ? $config['color_back'] : false;
74
+		$back = isset( $config[ 'color_back' ] ) ? $config[ 'color_back' ] : false;
75 75
 
76 76
 		$text_on_back              = '';
77 77
 		$border_on_back            = '';
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 			$hover_on_back  = ( 90 < $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness - 3 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness + 3 )->toCSS( $back_obj->mode );
94 94
 			$arrows_on_back = ( 50 > $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness + 30 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness - 30 )->toCSS( $back_obj->mode );
95 95
 		}
96
-		$accent     = ( isset( $config['color_accent'] ) ) ? $config['color_accent'] : false;
96
+		$accent = ( isset( $config[ 'color_accent' ] ) ) ? $config[ 'color_accent' ] : false;
97 97
 		if ( $accent ) {
98 98
 			$accent_obj                = ariColor::newColor( $accent );
99 99
 			$text_on_accent            = ( 60 > $accent_obj->lightness ) ? $accent_obj->getNew( 'lightness', $accent_obj->lightness + 60 )->toCSS( $accent_obj->mode ) : $accent_obj->getNew( 'lightness', $accent_obj->lightness - 60 )->toCSS( $accent_obj->mode );
@@ -405,18 +405,18 @@  discard block
 block discarded – undo
405 405
 			color: #444 !important;
406 406
 		}
407 407
 
408
-		<?php if ( isset( $config['width'] ) ) : ?>
408
+		<?php if ( isset( $config[ 'width' ] ) ) : ?>
409 409
 			.wp-full-overlay-sidebar {
410
-				width: <?php echo esc_attr( $config['width'] ); // WPCS: XSS ok. ?>;
410
+				width: <?php echo esc_attr( $config[ 'width' ] ); // WPCS: XSS ok. ?>;
411 411
 			}
412 412
 			.expanded .wp-full-overlay-footer {
413
-				width: <?php echo esc_attr( $config['width'] ); // WPCS: XSS ok. ?>;
413
+				width: <?php echo esc_attr( $config[ 'width' ] ); // WPCS: XSS ok. ?>;
414 414
 			}
415 415
 			.wp-full-overlay.expanded {
416
-				margin-left: <?php echo esc_attr( $config['width'] ); // WPCS: XSS ok. ?>;
416
+				margin-left: <?php echo esc_attr( $config[ 'width' ] ); // WPCS: XSS ok. ?>;
417 417
 			}
418 418
 			.wp-full-overlay.collapsed .wp-full-overlay-sidebar {
419
-				margin-left: -<?php echo esc_attr( $config['width'] ); // WPCS: XSS ok. ?>;
419
+				margin-left: -<?php echo esc_attr( $config[ 'width' ] ); // WPCS: XSS ok. ?>;
420 420
 			}
421 421
 		<?php endif; ?>
422 422
 		</style>
Please login to merge, or discard this patch.
modules/loading/class-kirki-modules-loading.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
 		}
64 64
 		// Allow disabling the custom loader using the kirki_config filter.
65 65
 		$config = apply_filters( 'kirki_config', array() );
66
-		if ( isset( $config['disable_loader'] ) && true === $config['disable_loader'] ) {
66
+		if ( isset( $config[ 'disable_loader' ] ) && true === $config[ 'disable_loader' ] ) {
67 67
 			return;
68 68
 		}
69 69
 		// Add the "loading" icon.
Please login to merge, or discard this patch.
modules/webfonts/class-kirki-fonts-google.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		$config = apply_filters( 'kirki_config', array() );
77 77
 
78 78
 		// If we have set $config['disable_google_fonts'] to true then do not proceed any further.
79
-		if ( isset( $config['disable_google_fonts'] ) && true === $config['disable_google_fonts'] ) {
79
+		if ( isset( $config[ 'disable_google_fonts' ] ) && true === $config[ 'disable_google_fonts' ] ) {
80 80
 			return;
81 81
 		}
82 82
 
@@ -113,64 +113,64 @@  discard block
 block discarded – undo
113 113
 	public function generate_google_font( $args ) {
114 114
 
115 115
 		// Process typography fields.
116
-		if ( isset( $args['type'] ) && 'kirki-typography' === $args['type'] ) {
116
+		if ( isset( $args[ 'type' ] ) && 'kirki-typography' === $args[ 'type' ] ) {
117 117
 
118 118
 			// Get the value.
119 119
 			$value = Kirki_Values::get_sanitized_field_value( $args );
120 120
 
121 121
 			// If we don't have a font-family then we can skip this.
122
-			if ( ! isset( $value['font-family'] ) ) {
122
+			if ( ! isset( $value[ 'font-family' ] ) ) {
123 123
 				return;
124 124
 			}
125 125
 
126 126
 			// If not a google-font, then we can skip this.
127
-			if ( ! Kirki_Fonts::is_google_font( $value['font-family'] ) ) {
127
+			if ( ! Kirki_Fonts::is_google_font( $value[ 'font-family' ] ) ) {
128 128
 				return;
129 129
 			}
130 130
 
131 131
 			// Set a default value for variants.
132
-			if ( ! isset( $value['variant'] ) ) {
133
-				$value['variant'] = 'regular';
132
+			if ( ! isset( $value[ 'variant' ] ) ) {
133
+				$value[ 'variant' ] = 'regular';
134 134
 			}
135
-			if ( isset( $value['subsets'] ) ) {
135
+			if ( isset( $value[ 'subsets' ] ) ) {
136 136
 
137 137
 				// Add the subset directly to the array of subsets in the Kirki_GoogleFonts_Manager object.
138 138
 				// Subsets must be applied to ALL fonts if possible.
139
-				if ( ! is_array( $value['subsets'] ) ) {
140
-					$this->subsets[] = $value['subsets'];
139
+				if ( ! is_array( $value[ 'subsets' ] ) ) {
140
+					$this->subsets[ ] = $value[ 'subsets' ];
141 141
 				} else {
142
-					foreach ( $value['subsets'] as $subset ) {
143
-						$this->subsets[] = $subset;
142
+					foreach ( $value[ 'subsets' ] as $subset ) {
143
+						$this->subsets[ ] = $subset;
144 144
 					}
145 145
 				}
146 146
 			}
147 147
 
148 148
 			// Add the requested google-font.
149
-			if ( ! isset( $this->fonts[ $value['font-family'] ] ) ) {
150
-				$this->fonts[ $value['font-family'] ] = array();
149
+			if ( ! isset( $this->fonts[ $value[ 'font-family' ] ] ) ) {
150
+				$this->fonts[ $value[ 'font-family' ] ] = array();
151 151
 			}
152
-			if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ], true ) ) {
153
-				$this->fonts[ $value['font-family'] ][] = $value['variant'];
152
+			if ( ! in_array( $value[ 'variant' ], $this->fonts[ $value[ 'font-family' ] ], true ) ) {
153
+				$this->fonts[ $value[ 'font-family' ] ][ ] = $value[ 'variant' ];
154 154
 			}
155 155
 			// Are we force-loading all variants?
156 156
 			if ( true === self::$force_load_all_variants ) {
157 157
 				$all_variants               = Kirki_Fonts::get_all_variants();
158
-				$args['choices']['variant'] = array_keys( $all_variants );
158
+				$args[ 'choices' ][ 'variant' ] = array_keys( $all_variants );
159 159
 			}
160 160
 
161
-			if ( ! empty( $args['choices']['variant'] ) && is_array( $args['choices']['variant'] ) ) {
162
-				foreach ( $args['choices']['variant'] as $extra_variant ) {
163
-					$this->fonts[ $value['font-family'] ][] = $extra_variant;
161
+			if ( ! empty( $args[ 'choices' ][ 'variant' ] ) && is_array( $args[ 'choices' ][ 'variant' ] ) ) {
162
+				foreach ( $args[ 'choices' ][ 'variant' ] as $extra_variant ) {
163
+					$this->fonts[ $value[ 'font-family' ] ][ ] = $extra_variant;
164 164
 				}
165 165
 			}
166 166
 		} else {
167 167
 
168 168
 			// Process non-typography fields.
169
-			if ( isset( $args['output'] ) && is_array( $args['output'] ) ) {
170
-				foreach ( $args['output'] as $output ) {
169
+			if ( isset( $args[ 'output' ] ) && is_array( $args[ 'output' ] ) ) {
170
+				foreach ( $args[ 'output' ] as $output ) {
171 171
 
172 172
 					// If we don't have a typography-related output argument we can skip this.
173
-					if ( ! isset( $output['property'] ) || ! in_array( $output['property'], array( 'font-family', 'font-weight', 'font-subset', 'subset', 'subsets' ), true ) ) {
173
+					if ( ! isset( $output[ 'property' ] ) || ! in_array( $output[ 'property' ], array( 'font-family', 'font-weight', 'font-subset', 'subset', 'subsets' ), true ) ) {
174 174
 						continue;
175 175
 					}
176 176
 
@@ -178,25 +178,25 @@  discard block
 block discarded – undo
178 178
 					$value = Kirki_Values::get_sanitized_field_value( $args );
179 179
 
180 180
 					if ( is_string( $value ) ) {
181
-						if ( 'font-family' === $output['property'] ) {
181
+						if ( 'font-family' === $output[ 'property' ] ) {
182 182
 							if ( ! array_key_exists( $value, $this->fonts ) ) {
183 183
 								$this->fonts[ $value ] = array();
184 184
 							}
185
-						} elseif ( 'font-weight' === $output['property'] ) {
185
+						} elseif ( 'font-weight' === $output[ 'property' ] ) {
186 186
 							foreach ( $this->fonts as $font => $variants ) {
187 187
 								if ( ! in_array( $value, $variants, true ) ) {
188
-									$this->fonts[ $font ][] = $value;
188
+									$this->fonts[ $font ][ ] = $value;
189 189
 								}
190 190
 							}
191
-						} elseif ( 'font-subset' === $output['property'] || 'subset' === $output['property'] || 'subsets' === $output['property'] ) {
191
+						} elseif ( 'font-subset' === $output[ 'property' ] || 'subset' === $output[ 'property' ] || 'subsets' === $output[ 'property' ] ) {
192 192
 							if ( ! is_array( $value ) ) {
193 193
 								if ( ! in_array( $value, $this->subsets, true ) ) {
194
-									$this->subsets[] = $value;
194
+									$this->subsets[ ] = $value;
195 195
 								}
196 196
 							} else {
197 197
 								foreach ( $value as $subset ) {
198 198
 									if ( ! in_array( $subset, $this->subsets, true ) ) {
199
-										$this->subsets[] = $subset;
199
+										$this->subsets[ ] = $subset;
200 200
 									}
201 201
 								}
202 202
 							}
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
 
232 232
 			// Get all valid font variants for this font.
233 233
 			$font_variants = array();
234
-			if ( isset( $this->google_fonts[ $font ]['variants'] ) ) {
235
-				$font_variants = $this->google_fonts[ $font ]['variants'];
234
+			if ( isset( $this->google_fonts[ $font ][ 'variants' ] ) ) {
235
+				$font_variants = $this->google_fonts[ $font ][ 'variants' ];
236 236
 			}
237 237
 			foreach ( $variants as $variant ) {
238 238
 
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 
248 248
 			// Check if the selected subsets exist, even in one of the selected fonts.
249 249
 			// If they don't, then they have to be removed otherwise the link will fail.
250
-			if ( isset( $this->google_fonts[ $font ]['subsets'] ) ) {
250
+			if ( isset( $this->google_fonts[ $font ][ 'subsets' ] ) ) {
251 251
 				foreach ( $this->subsets as $subset ) {
252
-					if ( in_array( $subset, $this->google_fonts[ $font ]['subsets'], true ) ) {
253
-						$valid_subsets[] = $subset;
252
+					if ( in_array( $subset, $this->google_fonts[ $font ][ 'subsets' ], true ) ) {
253
+						$valid_subsets[ ] = $subset;
254 254
 					}
255 255
 				}
256 256
 			}
Please login to merge, or discard this patch.
modules/webfonts/class-kirki-modules-webfonts.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -169,18 +169,18 @@
 block discarded – undo
169 169
 	 */
170 170
 	public function loop_fields( $config_id ) {
171 171
 		foreach ( Kirki::$fields as $field ) {
172
-			if ( isset( $field['kirki_config'] ) && $config_id !== $field['kirki_config'] ) {
172
+			if ( isset( $field[ 'kirki_config' ] ) && $config_id !== $field[ 'kirki_config' ] ) {
173 173
 				continue;
174 174
 			}
175 175
 			if ( true === apply_filters( "kirki_{$config_id}_webfonts_skip_hidden", true ) ) {
176 176
 				// Only continue if field dependencies are met.
177
-				if ( ! empty( $field['required'] ) ) {
177
+				if ( ! empty( $field[ 'required' ] ) ) {
178 178
 					$valid = true;
179 179
 
180
-					foreach ( $field['required'] as $requirement ) {
181
-						if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) ) {
182
-							$controller_value = Kirki_Values::get_value( $config_id, $requirement['setting'] );
183
-							if ( ! Kirki_Helper::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) {
180
+					foreach ( $field[ 'required' ] as $requirement ) {
181
+						if ( isset( $requirement[ 'setting' ] ) && isset( $requirement[ 'value' ] ) && isset( $requirement[ 'operator' ] ) ) {
182
+							$controller_value = Kirki_Values::get_value( $config_id, $requirement[ 'setting' ] );
183
+							if ( ! Kirki_Helper::compare_values( $controller_value, $requirement[ 'value' ], $requirement[ 'operator' ] ) ) {
184 184
 								$valid = false;
185 185
 							}
186 186
 						}
Please login to merge, or discard this patch.
modules/css/class-kirki-modules-css-generator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 	public static function css( $field ) {
147 147
 
148 148
 		// Set class vars.
149
-		self::$settings   = $field['settings'];
150
-		self::$callback   = $field['sanitize_callback'];
151
-		self::$field_type = $field['type'];
152
-		self::$output     = $field['output'];
149
+		self::$settings   = $field[ 'settings' ];
150
+		self::$callback   = $field[ 'sanitize_callback' ];
151
+		self::$field_type = $field[ 'type' ];
152
+		self::$output     = $field[ 'output' ];
153 153
 		if ( ! is_array( self::$output ) ) {
154 154
 			self::$output = array(
155 155
 				array(
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
 		// Find the class that will handle the outpout for this field.
166 166
 		$classname            = 'Kirki_Output';
167
-		$field_output_classes = apply_filters( "kirki_{$field['kirki_config']}_output_control_classnames", array(
167
+		$field_output_classes = apply_filters( "kirki_{$field[ 'kirki_config' ]}_output_control_classnames", array(
168 168
 			'kirki-background' => 'Kirki_Output_Field_Background',
169 169
 			'kirki-dimensions' => 'Kirki_Output_Field_Dimensions',
170 170
 			'kirki-image'      => 'Kirki_Output_Field_Image',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		if ( array_key_exists( self::$field_type, $field_output_classes ) ) {
175 175
 			$classname = $field_output_classes[ self::$field_type ];
176 176
 		}
177
-		$obj = new $classname( $field['kirki_config'], self::$output, self::$value, $field );
177
+		$obj = new $classname( $field[ 'kirki_config' ], self::$output, self::$value, $field );
178 178
 		return $obj->get_styles();
179 179
 
180 180
 	}
Please login to merge, or discard this patch.