Test Setup Failed
Pull Request — master (#1653)
by Aristeides
05:27
created
modules/css/class-kirki-output.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -83,13 +83,13 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	protected function apply_sanitize_callback( $output, $value ) {
85 85
 
86
-		if ( isset( $output['sanitize_callback'] ) && null !== $output['sanitize_callback'] ) {
86
+		if ( isset( $output[ 'sanitize_callback' ] ) && null !== $output[ 'sanitize_callback' ] ) {
87 87
 
88 88
 			// If the sanitize_callback is invalid, return the value.
89
-			if ( ! is_callable( $output['sanitize_callback'] ) ) {
89
+			if ( ! is_callable( $output[ 'sanitize_callback' ] ) ) {
90 90
 				return $value;
91 91
 			}
92
-			return call_user_func( $output['sanitize_callback'], $this->value );
92
+			return call_user_func( $output[ 'sanitize_callback' ], $this->value );
93 93
 		}
94 94
 
95 95
 		return $value;
@@ -105,22 +105,22 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	protected function apply_value_pattern( $output, $value ) {
107 107
 
108
-		if ( isset( $output['value_pattern'] ) && ! empty( $output['value_pattern'] ) && is_string( $output['value_pattern'] ) ) {
108
+		if ( isset( $output[ 'value_pattern' ] ) && ! empty( $output[ 'value_pattern' ] ) && is_string( $output[ 'value_pattern' ] ) ) {
109 109
 			if ( ! is_array( $value ) ) {
110
-				$value = str_replace( '$', $value, $output['value_pattern'] );
110
+				$value = str_replace( '$', $value, $output[ 'value_pattern' ] );
111 111
 			}
112 112
 			if ( is_array( $value ) ) {
113 113
 				foreach ( array_keys( $value ) as $value_k ) {
114 114
 					if ( ! is_string( $value[ $value_k ] ) ) {
115 115
 						continue;
116 116
 					}
117
-					if ( isset( $output['choice'] ) ) {
118
-						if ( $output['choice'] === $value_k ) {
119
-							$value[ $output['choice'] ] = str_replace( '$', $value[ $output['choice'] ], $output['value_pattern'] );
117
+					if ( isset( $output[ 'choice' ] ) ) {
118
+						if ( $output[ 'choice' ] === $value_k ) {
119
+							$value[ $output[ 'choice' ] ] = str_replace( '$', $value[ $output[ 'choice' ] ], $output[ 'value_pattern' ] );
120 120
 						}
121 121
 						continue;
122 122
 					}
123
-					$value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output['value_pattern'] );
123
+					$value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output[ 'value_pattern' ] );
124 124
 				}
125 125
 			}
126 126
 			$value = $this->apply_pattern_replace( $output, $value );
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
 	 * @return string|array
137 137
 	 */
138 138
 	protected function apply_pattern_replace( $output, $value ) {
139
-		if ( isset( $output['pattern_replace'] ) && is_array( $output['pattern_replace'] ) ) {
139
+		if ( isset( $output[ 'pattern_replace' ] ) && is_array( $output[ 'pattern_replace' ] ) ) {
140 140
 			$option_type = ( '' !== Kirki::get_config_param( $this->config_id, 'option_type' ) ) ? Kirki::get_config_param( $this->config_id, 'option_type' ) : 'theme_mod';
141 141
 			$option_name = Kirki::get_config_param( $this->config_id, 'option_name' );
142 142
 			$options     = array();
143 143
 			if ( $option_name ) {
144 144
 				$options = ( 'site_option' === $option_type ) ? get_site_option( $option_name ) : get_option( $option_name );
145 145
 			}
146
-			foreach ( $output['pattern_replace'] as $search => $replace ) {
146
+			foreach ( $output[ 'pattern_replace' ] as $search => $replace ) {
147 147
 				$replacement = '';
148 148
 				switch ( $option_type ) {
149 149
 					case 'option':
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 			}
205 205
 
206 206
 			// No need to proceed this if the current value is the same as in the "exclude" value.
207
-			if ( isset( $output['exclude'] ) && is_array( $output['exclude'] ) ) {
208
-				foreach ( $output['exclude'] as $exclude ) {
207
+			if ( isset( $output[ 'exclude' ] ) && is_array( $output[ 'exclude' ] ) ) {
208
+				foreach ( $output[ 'exclude' ] as $exclude ) {
209 209
 					if ( is_array( $value ) ) {
210 210
 						if ( is_array( $exclude ) ) {
211 211
 							$diff1 = array_diff( $value, $exclude );
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 						}
218 218
 						// If 'choice' is defined check for sub-values too.
219 219
 						// Fixes https://github.com/aristath/kirki/issues/1416.
220
-						if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) {
220
+						if ( isset( $output[ 'choice' ] ) && isset( $value[ $output[ 'choice' ] ] ) && $exclude == $value[ $output[ 'choice' ] ] ) {
221 221
 							$skip = true;
222 222
 						}
223 223
 					}
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
 			// Apply any value patterns defined.
239 239
 			$value = $this->apply_value_pattern( $output, $value );
240 240
 
241
-			if ( isset( $output['element'] ) && is_array( $output['element'] ) ) {
242
-				$output['element'] = array_unique( $output['element'] );
243
-				sort( $output['element'] );
244
-				$output['element'] = implode( ',', $output['element'] );
241
+			if ( isset( $output[ 'element' ] ) && is_array( $output[ 'element' ] ) ) {
242
+				$output[ 'element' ] = array_unique( $output[ 'element' ] );
243
+				sort( $output[ 'element' ] );
244
+				$output[ 'element' ] = implode( ',', $output[ 'element' ] );
245 245
 			}
246 246
 
247 247
 			$value = $this->process_value( $value, $output );
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 	 * @return null
260 260
 	 */
261 261
 	protected function process_output( $output, $value ) {
262
-		if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) {
262
+		if ( ! isset( $output[ 'element' ] ) || ! isset( $output[ 'property' ] ) ) {
263 263
 			return;
264 264
 		}
265
-		$output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global';
266
-		$output['prefix']      = ( isset( $output['prefix'] ) ) ? $output['prefix'] : '';
267
-		$output['units']       = ( isset( $output['units'] ) ) ? $output['units'] : '';
268
-		$output['suffix']      = ( isset( $output['suffix'] ) ) ? $output['suffix'] : '';
265
+		$output[ 'media_query' ] = ( isset( $output[ 'media_query' ] ) ) ? $output[ 'media_query' ] : 'global';
266
+		$output[ 'prefix' ]      = ( isset( $output[ 'prefix' ] ) ) ? $output[ 'prefix' ] : '';
267
+		$output[ 'units' ]       = ( isset( $output[ 'units' ] ) ) ? $output[ 'units' ] : '';
268
+		$output[ 'suffix' ]      = ( isset( $output[ 'suffix' ] ) ) ? $output[ 'suffix' ] : '';
269 269
 
270 270
 		// Properties that can accept multiple values.
271 271
 		// Useful for example for gradients where all browsers use the "background-image" property
@@ -274,14 +274,14 @@  discard block
 block discarded – undo
274 274
 			'background-image',
275 275
 			'background',
276 276
 		);
277
-		if ( in_array( $output['property'], $accepts_multiple, true ) ) {
278
-			if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) {
279
-				$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ];
277
+		if ( in_array( $output[ 'property' ], $accepts_multiple, true ) ) {
278
+			if ( isset( $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] ) && ! is_array( $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] ) ) {
279
+				$this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = (array) $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ];
280 280
 			}
281
-			$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
281
+			$this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ][ ] = $output[ 'prefix' ] . $value . $output[ 'units' ] . $output[ 'suffix' ];
282 282
 			return;
283 283
 		}
284
-		$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix'];
284
+		$this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value ) . $output[ 'units' ] . $output[ 'suffix' ];
285 285
 	}
286 286
 
287 287
 	/**
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 	 * @return string|array
320 320
 	 */
321 321
 	protected function process_value( $value, $output ) {
322
-		if ( isset( $output['property'] ) ) {
323
-			return $this->process_property_value( $output['property'], $value );
322
+		if ( isset( $output[ 'property' ] ) ) {
323
+			return $this->process_property_value( $output[ 'property' ], $value );
324 324
 		}
325 325
 		return $value;
326 326
 	}
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.
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/postmessage/class-kirki-modules-postmessage.php 1 patch
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		wp_enqueue_script( 'kirki_auto_postmessage', trailingslashit( Kirki::$url ) . 'modules/postmessage/postmessage.js', array( 'jquery', 'customize-preview' ), KIRKI_VERSION, true );
75 75
 		$fields = Kirki::$fields;
76 76
 		foreach ( $fields as $field ) {
77
-			if ( isset( $field['transport'] ) && 'postMessage' === $field['transport'] && isset( $field['js_vars'] ) && ! empty( $field['js_vars'] ) && is_array( $field['js_vars'] ) && isset( $field['settings'] ) ) {
77
+			if ( isset( $field[ 'transport' ] ) && 'postMessage' === $field[ 'transport' ] && isset( $field[ 'js_vars' ] ) && ! empty( $field[ 'js_vars' ] ) && is_array( $field[ 'js_vars' ] ) && isset( $field[ 'settings' ] ) ) {
78 78
 				$this->script .= $this->script( $field );
79 79
 			}
80 80
 		}
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	protected function script( $args ) {
94 94
 
95
-		$script = 'wp.customize(\'' . $args['settings'] . '\',function(value){value.bind(function(newval){';
95
+		$script = 'wp.customize(\'' . $args[ 'settings' ] . '\',function(value){value.bind(function(newval){';
96 96
 
97 97
 		$add_css = false;
98
-		foreach ( $args['js_vars'] as $js_var ) {
99
-			if ( ! isset( $js_var['function'] ) || 'html' !== $js_var['function'] ) {
98
+		foreach ( $args[ 'js_vars' ] as $js_var ) {
99
+			if ( ! isset( $js_var[ 'function' ] ) || 'html' !== $js_var[ 'function' ] ) {
100 100
 				$add_css = true;
101 101
 			}
102 102
 		}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
 			// append unique style tag if not exist
107 107
 			// The style ID.
108
-			$style_id = 'kirki-postmessage-' . str_replace( array( '[', ']' ), '', $args['settings'] );
108
+			$style_id = 'kirki-postmessage-' . str_replace( array( '[', ']' ), '', $args[ 'settings' ] );
109 109
 			$script .= 'if(null===document.getElementById(\'' . $style_id . '\')||\'undefined\'===typeof document.getElementById(\'' . $style_id . '\')){jQuery(\'head\').append(\'<style id="' . $style_id . '"></style>\');}';
110 110
 		}
111 111
 
@@ -116,46 +116,46 @@  discard block
 block discarded – undo
116 116
 			'scripts' => array(),
117 117
 		);
118 118
 		// Loop through the js_vars and generate the script.
119
-		foreach ( $args['js_vars'] as $key => $js_var ) {
119
+		foreach ( $args[ 'js_vars' ] as $key => $js_var ) {
120 120
 
121 121
 			// Skip styles if "exclude" is defined and value is excluded.
122
-			if ( isset( $js_var['exclude'] ) ) {
123
-				$js_var['exclude'] = (array) $js_var['exclude'];
122
+			if ( isset( $js_var[ 'exclude' ] ) ) {
123
+				$js_var[ 'exclude' ] = (array) $js_var[ 'exclude' ];
124 124
 				$script .= 'exclude=false;';
125
-				foreach ( $js_var['exclude'] as $exclussion ) {
125
+				foreach ( $js_var[ 'exclude' ] as $exclussion ) {
126 126
 					$script .= "if(newval=='{$exclussion}'||(''==='{$exclussion}'&&_.isObject(newval)&&_.isEmpty(newval))){exclude=true;}";
127 127
 				}
128 128
 			}
129
-			if ( isset( $js_var['element'] ) ) {
129
+			if ( isset( $js_var[ 'element' ] ) ) {
130 130
 				// Array to string.
131
-				if ( is_array( $js_var['element'] ) ) {
132
-					$js_var['element'] = implode( ',', $js_var['element'] );
131
+				if ( is_array( $js_var[ 'element' ] ) ) {
132
+					$js_var[ 'element' ] = implode( ',', $js_var[ 'element' ] );
133 133
 				}
134 134
 				// Replace single quotes with double quotes to avoid issues with the compiled JS.
135
-				$js_var['element'] = str_replace( '\'', '"', $js_var['element'] );
135
+				$js_var[ 'element' ] = str_replace( '\'', '"', $js_var[ 'element' ] );
136 136
 			}
137
-			if ( isset( $js_var['function'] ) && 'html' === $js_var['function'] ) {
137
+			if ( isset( $js_var[ 'function' ] ) && 'html' === $js_var[ 'function' ] ) {
138 138
 				$script .= $this->script_html_var( $js_var );
139 139
 				continue;
140 140
 			}
141
-			$js_var['index_key'] = $key;
141
+			$js_var[ 'index_key' ] = $key;
142 142
 			$callback = $this->get_callback( $args );
143 143
 			if ( is_callable( $callback ) ) {
144
-				$field['scripts'][ $key ] = call_user_func_array( $callback, array( $js_var, $args ) );
144
+				$field[ 'scripts' ][ $key ] = call_user_func_array( $callback, array( $js_var, $args ) );
145 145
 				continue;
146 146
 			}
147
-			$field['scripts'][ $key ] = $this->script_var( $js_var );
147
+			$field[ 'scripts' ][ $key ] = $this->script_var( $js_var );
148 148
 		}
149 149
 		$combo_extra_script = '';
150 150
 		$combo_css_script   = '';
151
-		foreach ( $field['scripts'] as $script_array ) {
152
-			$combo_extra_script .= $script_array['script'];
153
-			$combo_css_script   .= ( 'css' !== $combo_css_script ) ? $script_array['css'] : '';
151
+		foreach ( $field[ 'scripts' ] as $script_array ) {
152
+			$combo_extra_script .= $script_array[ 'script' ];
153
+			$combo_css_script   .= ( 'css' !== $combo_css_script ) ? $script_array[ 'css' ] : '';
154 154
 		}
155 155
 		$text = ( 'css' === $combo_css_script ) ? 'css' : '\'' . $combo_css_script . '\'';
156 156
 
157 157
 		$script .= $combo_extra_script . "var cssContent={$text};";
158
-		if ( isset( $js_var['exclude'] ) ) {
158
+		if ( isset( $js_var[ 'exclude' ] ) ) {
159 159
 			$script .= 'if(true===exclude){cssContent="";}';
160 160
 		}
161 161
 		if ( $add_css ) {
@@ -174,18 +174,18 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	protected function script_html_var( $args ) {
176 176
 
177
-		$script = ( isset( $args['choice'] ) ) ? "newval=newval['{$args['choice']}'];" : '';
177
+		$script = ( isset( $args[ 'choice' ] ) ) ? "newval=newval['{$args[ 'choice' ]}'];" : '';
178 178
 
179 179
 		// Apply the value_pattern.
180
-		if ( isset( $args['value_pattern'] ) && '' !== $args['value_pattern'] ) {
180
+		if ( isset( $args[ 'value_pattern' ] ) && '' !== $args[ 'value_pattern' ] ) {
181 181
 			$script .= $this->value_pattern_replacements( 'newval', $args );
182 182
 		}
183 183
 
184
-		if ( isset( $args['attr'] ) ) {
185
-			$script .= "jQuery('{$args['element']}').attr('{$args['attr']}',newval);";
184
+		if ( isset( $args[ 'attr' ] ) ) {
185
+			$script .= "jQuery('{$args[ 'element' ]}').attr('{$args[ 'attr' ]}',newval);";
186 186
 			return $script;
187 187
 		}
188
-		$script .= "jQuery('{$args['element']}').html(newval);";
188
+		$script .= "jQuery('{$args[ 'element' ]}').html(newval);";
189 189
 		return $script;
190 190
 	}
191 191
 
@@ -200,34 +200,34 @@  discard block
 block discarded – undo
200 200
 		$script = '';
201 201
 		$property_script = '';
202 202
 
203
-		$value_key = 'newval' . $args['index_key'];
203
+		$value_key = 'newval' . $args[ 'index_key' ];
204 204
 		$property_script .= $value_key . '=newval;';
205 205
 
206 206
 		$args = $this->get_args( $args );
207 207
 
208 208
 		// Apply callback to the value if a callback is defined.
209
-		if ( ! empty( $args['js_callback'] ) && is_array( $args['js_callback'] ) && isset( $args['js_callback'][0] ) && ! empty( $args['js_callback'][0] ) ) {
210
-			$script .= $value_key . '=' . $args['js_callback'][0] . '(' . $value_key . ',' . $args['js_callback'][1] . ');';
209
+		if ( ! empty( $args[ 'js_callback' ] ) && is_array( $args[ 'js_callback' ] ) && isset( $args[ 'js_callback' ][ 0 ] ) && ! empty( $args[ 'js_callback' ][ 0 ] ) ) {
210
+			$script .= $value_key . '=' . $args[ 'js_callback' ][ 0 ] . '(' . $value_key . ',' . $args[ 'js_callback' ][ 1 ] . ');';
211 211
 		}
212 212
 
213 213
 		// Apply the value_pattern.
214
-		if ( '' !== $args['value_pattern'] ) {
214
+		if ( '' !== $args[ 'value_pattern' ] ) {
215 215
 			$script .= $this->value_pattern_replacements( $value_key, $args );
216 216
 		}
217 217
 
218 218
 		// Tweak to add url() for background-images.
219
-		if ( 'background-image' === $args['property'] && ( ! isset( $args['value_pattern'] ) || false === strpos( $args['value_pattern'], 'gradient' ) ) ) {
219
+		if ( 'background-image' === $args[ 'property' ] && ( ! isset( $args[ 'value_pattern' ] ) || false === strpos( $args[ 'value_pattern' ], 'gradient' ) ) ) {
220 220
 			$script .= 'if(-1===' . $value_key . '.indexOf(\'url(\')){' . $value_key . '=\'url("\'+' . $value_key . '+\'")\';}';
221 221
 		}
222 222
 
223 223
 		// Apply prefix.
224 224
 		$value = $value_key;
225
-		if ( '' !== $args['prefix'] ) {
226
-			$value = "'" . $args['prefix'] . "'+" . $value_key;
225
+		if ( '' !== $args[ 'prefix' ] ) {
226
+			$value = "'" . $args[ 'prefix' ] . "'+" . $value_key;
227 227
 		}
228
-		$css = $args['element'] . '{' . $args['property'] . ':\'+' . $value . '+\'' . $args['units'] . $args['suffix'] . ';}';
229
-		if ( isset( $args['media_query'] ) ) {
230
-			$css = $args['media_query'] . '{' . $css . '}';
228
+		$css = $args[ 'element' ] . '{' . $args[ 'property' ] . ':\'+' . $value . '+\'' . $args[ 'units' ] . $args[ 'suffix' ] . ';}';
229
+		if ( isset( $args[ 'media_query' ] ) ) {
230
+			$css = $args[ 'media_query' ] . '{' . $css . '}';
231 231
 		}
232 232
 		return array(
233 233
 			'script' => $property_script . $script,
@@ -244,59 +244,59 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	protected function script_var_array( $args ) {
246 246
 
247
-		$script = ( 0 === $args['index_key'] ) ? 'css=\'\';' : '';
247
+		$script = ( 0 === $args[ 'index_key' ] ) ? 'css=\'\';' : '';
248 248
 		$property_script = '';
249 249
 
250 250
 		// Define choice.
251
-		$choice = ( isset( $args['choice'] ) && '' !== $args['choice'] ) ? $args['choice'] : '';
251
+		$choice = ( isset( $args[ 'choice' ] ) && '' !== $args[ 'choice' ] ) ? $args[ 'choice' ] : '';
252 252
 
253
-		$value_key = 'newval' . $args['index_key'];
253
+		$value_key = 'newval' . $args[ 'index_key' ];
254 254
 		$property_script .= $value_key . '=newval;';
255 255
 
256 256
 		$args = $this->get_args( $args );
257 257
 
258 258
 		// Apply callback to the value if a callback is defined.
259
-		if ( ! empty( $args['js_callback'] ) && is_array( $args['js_callback'] ) && isset( $args['js_callback'][0] ) && ! empty( $args['js_callback'][0] ) ) {
260
-			$script .= $value_key . '=' . $args['js_callback'][0] . '(' . $value_key . ',' . $args['js_callback'][1] . ');';
259
+		if ( ! empty( $args[ 'js_callback' ] ) && is_array( $args[ 'js_callback' ] ) && isset( $args[ 'js_callback' ][ 0 ] ) && ! empty( $args[ 'js_callback' ][ 0 ] ) ) {
260
+			$script .= $value_key . '=' . $args[ 'js_callback' ][ 0 ] . '(' . $value_key . ',' . $args[ 'js_callback' ][ 1 ] . ');';
261 261
 		}
262 262
 		$script .= '_.each(' . $value_key . ', function(subValue,subKey){';
263 263
 
264 264
 		// Apply the value_pattern.
265
-		if ( '' !== $args['value_pattern'] ) {
265
+		if ( '' !== $args[ 'value_pattern' ] ) {
266 266
 			$script .= $this->value_pattern_replacements( 'subValue', $args );
267 267
 		}
268 268
 
269 269
 		// Tweak to add url() for background-images.
270 270
 		if ( '' === $choice || 'background-image' === $choice ) {
271
-			$script .= 'if(\'background-image\'===\'' . $args['property'] . '\'||\'background-image\'===subKey){if(-1===subValue.indexOf(\'url(\')){subValue=\'url("\'+subValue+\'")\';}}';
271
+			$script .= 'if(\'background-image\'===\'' . $args[ 'property' ] . '\'||\'background-image\'===subKey){if(-1===subValue.indexOf(\'url(\')){subValue=\'url("\'+subValue+\'")\';}}';
272 272
 		}
273 273
 
274 274
 		// Apply prefix.
275 275
 		$value = $value_key;
276
-		if ( '' !== $args['prefix'] ) {
277
-			$value = '\'' . $args['prefix'] . '\'+subValue';
276
+		if ( '' !== $args[ 'prefix' ] ) {
277
+			$value = '\'' . $args[ 'prefix' ] . '\'+subValue';
278 278
 		}
279 279
 
280 280
 		// Mostly used for padding, margin & position properties.
281 281
 		$direction_script  = 'if(_.contains([\'top\',\'bottom\',\'left\',\'right\'],subKey)){';
282
-		$direction_script .= 'css+=\'' . $args['element'] . '{' . $args['property'] . '-\'+subKey+\':\'+subValue+\'' . $args['units'] . $args['suffix'] . ';}\';}';
282
+		$direction_script .= 'css+=\'' . $args[ 'element' ] . '{' . $args[ 'property' ] . '-\'+subKey+\':\'+subValue+\'' . $args[ 'units' ] . $args[ 'suffix' ] . ';}\';}';
283 283
 		// Allows us to apply this just for a specific choice in the array of the values.
284 284
 		if ( '' !== $choice ) {
285 285
 			$choice_is_direction = ( false !== strpos( $choice, 'top' ) || false !== strpos( $choice, 'bottom' ) || false !== strpos( $choice, 'left' ) || false !== strpos( $choice, 'right' ) );
286 286
 			$script .= 'if(\'' . $choice . '\'===subKey){';
287 287
 			$script .= ( $choice_is_direction ) ? $direction_script . 'else{' : '';
288
-			$script .= 'css+=\'' . $args['element'] . '{' . $args['property'] . ':\'+subValue+\';}\';';
288
+			$script .= 'css+=\'' . $args[ 'element' ] . '{' . $args[ 'property' ] . ':\'+subValue+\';}\';';
289 289
 			$script .= ( $choice_is_direction ) ? '}' : '';
290 290
 			$script .= '}';
291 291
 		} else {
292 292
 
293 293
 			// This is where most object-based fields will go.
294
-			$script .= $direction_script . 'else{css+=\'' . $args['element'] . '{\'+subKey+\':\'+subValue+\'' . $args['units'] . $args['suffix'] . ';}\';}';
294
+			$script .= $direction_script . 'else{css+=\'' . $args[ 'element' ] . '{\'+subKey+\':\'+subValue+\'' . $args[ 'units' ] . $args[ 'suffix' ] . ';}\';}';
295 295
 		}
296 296
 		$script .= '});';
297 297
 
298
-		if ( isset( $args['media_query'] ) ) {
299
-			$script .= 'css=\'' . $args['media_query'] . '{\'+css+\'}\';';
298
+		if ( isset( $args[ 'media_query' ] ) ) {
299
+			$script .= 'css=\'' . $args[ 'media_query' ] . '{\'+css+\'}\';';
300 300
 		}
301 301
 
302 302
 		return array(
@@ -338,41 +338,41 @@  discard block
 block discarded – undo
338 338
 			'font-weight'     => 'fontWeight',
339 339
 			'font-style'      => 'fontStyle',
340 340
 		);
341
-		$choice_condition = ( isset( $args['choice'] ) && '' !== $args['choice'] && isset( $css_build_array[ $args['choice'] ] ) );
341
+		$choice_condition = ( isset( $args[ 'choice' ] ) && '' !== $args[ 'choice' ] && isset( $css_build_array[ $args[ 'choice' ] ] ) );
342 342
 		$script .= ( ! $choice_condition ) ? $webfont_loader : '';
343 343
 		foreach ( $css_build_array as $property => $var ) {
344
-			if ( $choice_condition && $property !== $args['choice'] ) {
344
+			if ( $choice_condition && $property !== $args[ 'choice' ] ) {
345 345
 				continue;
346 346
 			}
347 347
 			// Fixes https://github.com/aristath/kirki/issues/1436.
348
-			if ( ! isset( $field['default'] ) || (
349
-				( 'font-family' === $property && ! isset( $field['default']['font-family'] ) ) ||
350
-				( 'font-size' === $property && ! isset( $field['default']['font-size'] ) ) ||
351
-				( 'line-height' === $property && ! isset( $field['default']['line-height'] ) ) ||
352
-				( 'letter-spacing' === $property && ! isset( $field['default']['letter-spacing'] ) ) ||
353
-				( 'word-spacing' === $property && ! isset( $field['default']['word-spacing'] ) ) ||
354
-				( 'text-align' === $property && ! isset( $field['default']['text-align'] ) ) ||
355
-				( 'text-transform' === $property && ! isset( $field['default']['text-transform'] ) ) ||
356
-				( 'text-decoration' === $property && ! isset( $field['default']['text-decoration'] ) ) ||
357
-				( 'color' === $property && ! isset( $field['default']['color'] ) ) ||
358
-				( 'font-weight' === $property && ! isset( $field['default']['variant'] ) && ! isset( $field['default']['font-weight'] ) ) ||
359
-				( 'font-style' === $property && ! isset( $field['default']['variant'] ) && ! isset( $field['default']['font-style'] ) )
348
+			if ( ! isset( $field[ 'default' ] ) || (
349
+				( 'font-family' === $property && ! isset( $field[ 'default' ][ 'font-family' ] ) ) ||
350
+				( 'font-size' === $property && ! isset( $field[ 'default' ][ 'font-size' ] ) ) ||
351
+				( 'line-height' === $property && ! isset( $field[ 'default' ][ 'line-height' ] ) ) ||
352
+				( 'letter-spacing' === $property && ! isset( $field[ 'default' ][ 'letter-spacing' ] ) ) ||
353
+				( 'word-spacing' === $property && ! isset( $field[ 'default' ][ 'word-spacing' ] ) ) ||
354
+				( 'text-align' === $property && ! isset( $field[ 'default' ][ 'text-align' ] ) ) ||
355
+				( 'text-transform' === $property && ! isset( $field[ 'default' ][ 'text-transform' ] ) ) ||
356
+				( 'text-decoration' === $property && ! isset( $field[ 'default' ][ 'text-decoration' ] ) ) ||
357
+				( 'color' === $property && ! isset( $field[ 'default' ][ 'color' ] ) ) ||
358
+				( 'font-weight' === $property && ! isset( $field[ 'default' ][ 'variant' ] ) && ! isset( $field[ 'default' ][ 'font-weight' ] ) ) ||
359
+				( 'font-style' === $property && ! isset( $field[ 'default' ][ 'variant' ] ) && ! isset( $field[ 'default' ][ 'font-style' ] ) )
360 360
 				) ) {
361 361
 				continue;
362 362
 			}
363
-			$script .= ( $choice_condition && 'font-family' === $args['choice'] ) ? $webfont_loader : '';
363
+			$script .= ( $choice_condition && 'font-family' === $args[ 'choice' ] ) ? $webfont_loader : '';
364 364
 
365
-			if ( 'font-family' === $property || ( isset( $args['choice'] ) && 'font-family' === $args['choice'] ) ) {
365
+			if ( 'font-family' === $property || ( isset( $args[ 'choice' ] ) && 'font-family' === $args[ 'choice' ] ) ) {
366 366
 				$css .= 'fontFamilyCSS=fontFamily;if(0<fontFamily.indexOf(\' \')&&-1===fontFamily.indexOf(\'"\')){fontFamilyCSS=\'"\'+fontFamily+\'"\';}';
367 367
 				$var = 'fontFamilyCSS';
368 368
 			}
369
-			$var = ( ( empty( $args['prefix'] ) ) ? '' : '\'' . $args['prefix'] . '\'+' ) . $var . ( ( empty( $args['units'] ) ) ? '' : '+\'' . $args['units'] . '\'' ) . ( ( empty( $args['suffix'] ) ) ? '' : '+\'' . $args['suffix'] . '\'' );
370
-			$css .= 'css+=(\'\'!==' . $var . ')?\'' . $args['element'] . '\'+\'{' . $property . ':\'+' . $var . '+\';}\':\'\';';
369
+			$var = ( ( empty( $args[ 'prefix' ] ) ) ? '' : '\'' . $args[ 'prefix' ] . '\'+' ) . $var . ( ( empty( $args[ 'units' ] ) ) ? '' : '+\'' . $args[ 'units' ] . '\'' ) . ( ( empty( $args[ 'suffix' ] ) ) ? '' : '+\'' . $args[ 'suffix' ] . '\'' );
370
+			$css .= 'css+=(\'\'!==' . $var . ')?\'' . $args[ 'element' ] . '\'+\'{' . $property . ':\'+' . $var . '+\';}\':\'\';';
371 371
 		}
372 372
 
373 373
 		$script .= $css;
374
-		if ( isset( $args['media_query'] ) ) {
375
-			$script .= 'css=\'' . $args['media_query'] . '{\'+css+\'}\';';
374
+		if ( isset( $args[ 'media_query' ] ) ) {
375
+			$script .= 'css=\'' . $args[ 'media_query' ] . '{\'+css+\'}\';';
376 376
 		}
377 377
 		return array(
378 378
 			'script' => $script,
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 	protected function script_var_image( $args ) {
391 391
 		$return = $this->script_var( $args );
392 392
 		return array(
393
-			'script' => 'newval=(!_.isUndefined(newval.url))?newval.url:newval;' . $return['script'],
394
-			'css'    => $return['css'],
393
+			'script' => 'newval=(!_.isUndefined(newval.url))?newval.url:newval;' . $return[ 'script' ],
394
+			'css'    => $return[ 'css' ],
395 395
 		);
396 396
 	}
397 397
 
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
 
408 408
 		$script = '';
409 409
 
410
-		if ( isset( $args['type'] ) ) {
411
-			switch ( $args['type'] ) {
410
+		if ( isset( $args[ 'type' ] ) ) {
411
+			switch ( $args[ 'type' ] ) {
412 412
 				case 'kirki-typography':
413 413
 					$script .= 'fontFamily=(_.isUndefined(newval[\'font-family\']))?\'\':newval[\'font-family\'];variant=(_.isUndefined(newval.variant))?\'400\':newval.variant;subsets=(_.isUndefined(newval.subsets))?[]:newval.subsets;subsetsString=(_.isObject(newval.subsets))?\':\'+newval.subsets.join(\',\'):\'\';fontSize=(_.isUndefined(newval[\'font-size\']))?\'\':newval[\'font-size\'];lineHeight=(_.isUndefined(newval[\'line-height\']))?\'\':newval[\'line-height\'];letterSpacing=(_.isUndefined(newval[\'letter-spacing\']))?\'\':newval[\'letter-spacing\'];wordSpacing=(_.isUndefined(newval[\'word-spacing\']))?\'\':newval[\'word-spacing\'];textAlign=(_.isUndefined(newval[\'text-align\']))?\'\':newval[\'text-align\'];textTransform=(_.isUndefined(newval[\'text-transform\']))?\'\':newval[\'text-transform\'];textDecoration=(_.isUndefined(newval[\'text-decoration\']))?\'\':newval[\'text-decoration\'];color=(_.isUndefined(newval.color))?\'\':newval.color;fw=(!_.isString(newval.variant))?\'400\':newval.variant.match(/\d/g);fontWeight=(!_.isObject(fw))?400:fw.join(\'\');fontStyle=(-1!==variant.indexOf(\'italic\'))?\'italic\':\'normal\';css=\'\';';
414 414
 					break;
@@ -441,17 +441,17 @@  discard block
 block discarded – undo
441 441
 		);
442 442
 
443 443
 		// Element should be a string.
444
-		if ( is_array( $args['element'] ) ) {
445
-			$args['element'] = implode( ',', $args['element'] );
444
+		if ( is_array( $args[ 'element' ] ) ) {
445
+			$args[ 'element' ] = implode( ',', $args[ 'element' ] );
446 446
 		}
447 447
 
448 448
 		// Make sure arguments that are passed-on to callbacks are strings.
449
-		if ( is_array( $args['js_callback'] ) && isset( $args['js_callback'][1] ) && is_array( $args['js_callback'][1] ) ) {
450
-			$args['js_callback'][1] = wp_json_encode( $args['js_callback'][1] );
449
+		if ( is_array( $args[ 'js_callback' ] ) && isset( $args[ 'js_callback' ][ 1 ] ) && is_array( $args[ 'js_callback' ][ 1 ] ) ) {
450
+			$args[ 'js_callback' ][ 1 ] = wp_json_encode( $args[ 'js_callback' ][ 1 ] );
451 451
 		}
452 452
 
453
-		if ( ! isset( $args['js_callback'][1] ) ) {
454
-			$args['js_callback'][1] = '';
453
+		if ( ! isset( $args[ 'js_callback' ][ 1 ] ) ) {
454
+			$args[ 'js_callback' ][ 1 ] = '';
455 455
 		}
456 456
 		return $args;
457 457
 
@@ -469,15 +469,15 @@  discard block
 block discarded – undo
469 469
 	private function value_pattern_replacements( $value, $js_vars ) {
470 470
 		$script = '';
471 471
 		$alias  = $value;
472
-		if ( ! isset( $js_vars['value_pattern'] ) ) {
472
+		if ( ! isset( $js_vars[ 'value_pattern' ] ) ) {
473 473
 			return $value;
474 474
 		}
475
-		$value = $js_vars['value_pattern'];
476
-		if ( isset( $js_vars['pattern_replace'] ) ) {
475
+		$value = $js_vars[ 'value_pattern' ];
476
+		if ( isset( $js_vars[ 'pattern_replace' ] ) ) {
477 477
 			$script .= 'settings=window.wp.customize.get();';
478
-			foreach ( $js_vars['pattern_replace'] as $search => $replace ) {
478
+			foreach ( $js_vars[ 'pattern_replace' ] as $search => $replace ) {
479 479
 				$replace = '\'+settings["' . $replace . '"]+\'';
480
-				$value = str_replace( $search, $replace, $js_vars['value_pattern'] );
480
+				$value = str_replace( $search, $replace, $js_vars[ 'value_pattern' ] );
481 481
 				$value = trim( $value, '+' );
482 482
 			}
483 483
 		}
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 	 */
498 498
 	protected function get_callback( $args ) {
499 499
 
500
-		switch ( $args['type'] ) {
500
+		switch ( $args[ 'type' ] ) {
501 501
 			case 'kirki-background':
502 502
 			case 'kirki-dimensions':
503 503
 			case 'kirki-multicolor':
Please login to merge, or discard this patch.
controls/php/class-kirki-control-select.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,6 +44,6 @@
 block discarded – undo
44 44
 	public function to_json() {
45 45
 		parent::to_json();
46 46
 
47
-		$this->json['multiple'] = $this->multiple;
47
+		$this->json[ 'multiple' ] = $this->multiple;
48 48
 	}
49 49
 }
Please login to merge, or discard this patch.
controls/php/class-kirki-control-base.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -128,30 +128,30 @@
 block discarded – undo
128 128
 		// Get the basics from the parent class.
129 129
 		parent::to_json();
130 130
 		// Default.
131
-		$this->json['default'] = $this->setting->default;
131
+		$this->json[ 'default' ] = $this->setting->default;
132 132
 		if ( isset( $this->default ) ) {
133
-			$this->json['default'] = $this->default;
133
+			$this->json[ 'default' ] = $this->default;
134 134
 		}
135 135
 		// Required.
136
-		$this->json['required'] = $this->required;
136
+		$this->json[ 'required' ] = $this->required;
137 137
 		// Output.
138
-		$this->json['output'] = $this->output;
138
+		$this->json[ 'output' ] = $this->output;
139 139
 		// Value.
140
-		$this->json['value'] = $this->value();
140
+		$this->json[ 'value' ] = $this->value();
141 141
 		// Choices.
142
-		$this->json['choices'] = $this->choices;
142
+		$this->json[ 'choices' ] = $this->choices;
143 143
 		// The link.
144
-		$this->json['link'] = $this->get_link();
144
+		$this->json[ 'link' ] = $this->get_link();
145 145
 		// The ID.
146
-		$this->json['id'] = $this->id;
146
+		$this->json[ 'id' ] = $this->id;
147 147
 		// Translation strings.
148
-		$this->json['l10n'] = $this->l10n();
148
+		$this->json[ 'l10n' ] = $this->l10n();
149 149
 		// The ajaxurl in case we need it.
150
-		$this->json['ajaxurl'] = admin_url( 'admin-ajax.php' );
150
+		$this->json[ 'ajaxurl' ] = admin_url( 'admin-ajax.php' );
151 151
 		// Input attributes.
152
-		$this->json['inputAttrs'] = '';
152
+		$this->json[ 'inputAttrs' ] = '';
153 153
 		foreach ( $this->input_attrs as $attr => $value ) {
154
-			$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
154
+			$this->json[ 'inputAttrs' ] .= $attr . '="' . esc_attr( $value ) . '" ';
155 155
 		}
156 156
 	}
157 157
 
Please login to merge, or discard this patch.
controls/php/class-kirki-control-multicolor.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
 	public function to_json() {
44 44
 		parent::to_json();
45 45
 
46
-		$this->json['alpha'] = (bool) $this->alpha;
46
+		$this->json[ 'alpha' ] = (bool) $this->alpha;
47 47
 	}
48 48
 
49 49
 	/**
Please login to merge, or discard this patch.
controls/php/class-kirki-control-typography.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		if ( Kirki_Util::get_wp_version() >= 4.9 ) {
40 40
 			return;
41 41
 		}
42
-		$custom_fonts_array  = ( isset( $this->choices['fonts'] ) && ( isset( $this->choices['fonts']['google'] ) || isset( $this->choices['fonts']['standard'] ) ) && ( ! empty( $this->choices['fonts']['google'] ) || ! empty( $this->choices['fonts']['standard'] ) ) );
42
+		$custom_fonts_array  = ( isset( $this->choices[ 'fonts' ] ) && ( isset( $this->choices[ 'fonts' ][ 'google' ] ) || isset( $this->choices[ 'fonts' ][ 'standard' ] ) ) && ( ! empty( $this->choices[ 'fonts' ][ 'google' ] ) || ! empty( $this->choices[ 'fonts' ][ 'standard' ] ) ) );
43 43
 		$localize_script_var = ( $custom_fonts_array ) ? 'kirkiFonts' . $this->id : 'kirkiAllFonts';
44 44
 		wp_localize_script(
45 45
 			'kirki-script', $localize_script_var, array(
@@ -57,25 +57,25 @@  discard block
 block discarded – undo
57 57
 	public function to_json() {
58 58
 		parent::to_json();
59 59
 
60
-		if ( is_array( $this->json['value'] ) ) {
61
-			foreach ( array_keys( $this->json['value'] ) as $key ) {
62
-				if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json['default'][ $key ] ) ) {
63
-					unset( $this->json['value'][ $key ] );
60
+		if ( is_array( $this->json[ 'value' ] ) ) {
61
+			foreach ( array_keys( $this->json[ 'value' ] ) as $key ) {
62
+				if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json[ 'default' ][ $key ] ) ) {
63
+					unset( $this->json[ 'value' ][ $key ] );
64 64
 				}
65 65
 				// Fix for https://wordpress.org/support/topic/white-font-after-updateing-to-3-0-16.
66
-				if ( ! isset( $this->json['default'][ $key ] ) ) {
67
-					unset( $this->json['value'][ $key ] );
66
+				if ( ! isset( $this->json[ 'default' ][ $key ] ) ) {
67
+					unset( $this->json[ 'value' ][ $key ] );
68 68
 				}
69 69
 				// Fix for https://github.com/aristath/kirki/issues/1405.
70
-				if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) {
71
-					unset( $this->json['value'][ $key ] );
70
+				if ( isset( $this->json[ 'default' ][ $key ] ) && false === $this->json[ 'default' ][ $key ] ) {
71
+					unset( $this->json[ 'value' ][ $key ] );
72 72
 				}
73 73
 			}
74 74
 		}
75 75
 
76
-		$this->json['show_variants'] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true;
77
-		$this->json['show_subsets']  = ( true === Kirki_Fonts_Google::$force_load_all_subsets ) ? false : true;
78
-		$this->json['languages']     = Kirki_Fonts::get_google_font_subsets();
76
+		$this->json[ 'show_variants' ] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true;
77
+		$this->json[ 'show_subsets' ]  = ( true === Kirki_Fonts_Google::$force_load_all_subsets ) ? false : true;
78
+		$this->json[ 'languages' ]     = Kirki_Fonts::get_google_font_subsets();
79 79
 	}
80 80
 
81 81
 	/**
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
 		$final_variants = array();
283 283
 		foreach ( $variants as $variant ) {
284 284
 			if ( is_string( $variant ) ) {
285
-				$final_variants[] = array(
285
+				$final_variants[ ] = array(
286 286
 					'id'    => $variant,
287 287
 					'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant,
288 288
 				);
289
-			} elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) {
290
-				$final_variants[] = $variant;
289
+			} elseif ( is_array( $variant ) && isset( $variant[ 'id' ] ) && isset( $variant[ 'label' ] ) ) {
290
+				$final_variants[ ] = $variant;
291 291
 			}
292 292
 		}
293 293
 		return $final_variants;
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 		$standard_fonts = Kirki_Fonts::get_standard_fonts();
306 306
 
307 307
 		$std_user_keys = array();
308
-		if ( isset( $this->choices['fonts'] ) && isset( $this->choices['fonts']['standard'] ) ) {
309
-			$std_user_keys = $this->choices['fonts']['standard'];
308
+		if ( isset( $this->choices[ 'fonts' ] ) && isset( $this->choices[ 'fonts' ][ 'standard' ] ) ) {
309
+			$std_user_keys = $this->choices[ 'fonts' ][ 'standard' ];
310 310
 		}
311 311
 
312 312
 		$standard_fonts_final = array();
@@ -319,15 +319,15 @@  discard block
 block discarded – undo
319 319
 			)
320 320
 		);
321 321
 		foreach ( $standard_fonts as $key => $font ) {
322
-			if ( ( ! empty( $std_user_keys ) && ! in_array( $key, $std_user_keys, true ) ) || ! isset( $font['stack'] ) || ! isset( $font['label'] ) ) {
322
+			if ( ( ! empty( $std_user_keys ) && ! in_array( $key, $std_user_keys, true ) ) || ! isset( $font[ 'stack' ] ) || ! isset( $font[ 'label' ] ) ) {
323 323
 				continue;
324 324
 			}
325
-			$standard_fonts_final[] = array(
326
-				'family'      => $font['stack'],
327
-				'label'       => $font['label'],
325
+			$standard_fonts_final[ ] = array(
326
+				'family'      => $font[ 'stack' ],
327
+				'label'       => $font[ 'label' ],
328 328
 				'subsets'     => array(),
329 329
 				'is_standard' => true,
330
-				'variants'    => ( isset( $font['variants'] ) ) ? $this->format_variants_array( $font['variants'] ) : $default_variants,
330
+				'variants'    => ( isset( $font[ 'variants' ] ) ) ? $this->format_variants_array( $font[ 'variants' ] ) : $default_variants,
331 331
 			);
332 332
 		}
333 333
 		return $standard_fonts_final;
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
 		$all_subsets  = Kirki_Fonts::get_google_font_subsets();
348 348
 
349 349
 		$gf_user_keys = array();
350
-		if ( isset( $this->choices['fonts'] ) && isset( $this->choices['fonts']['google'] ) ) {
351
-			$gf_user_keys = $this->choices['fonts']['google'];
350
+		if ( isset( $this->choices[ 'fonts' ] ) && isset( $this->choices[ 'fonts' ][ 'google' ] ) ) {
351
+			$gf_user_keys = $this->choices[ 'fonts' ][ 'google' ];
352 352
 		}
353 353
 
354 354
 		$google_fonts_final = array();
@@ -357,15 +357,15 @@  discard block
 block discarded – undo
357 357
 				continue;
358 358
 			}
359 359
 
360
-			$label    = ( isset( $args['label'] ) ) ? $args['label'] : $family;
361
-			$variants = ( isset( $args['variants'] ) ) ? $args['variants'] : array( 'regular', '700' );
362
-			$subsets  = ( isset( $args['subsets'] ) ) ? $args['subsets'] : array();
360
+			$label    = ( isset( $args[ 'label' ] ) ) ? $args[ 'label' ] : $family;
361
+			$variants = ( isset( $args[ 'variants' ] ) ) ? $args[ 'variants' ] : array( 'regular', '700' );
362
+			$subsets  = ( isset( $args[ 'subsets' ] ) ) ? $args[ 'subsets' ] : array();
363 363
 
364 364
 			$available_variants = array();
365 365
 			if ( is_array( $variants ) ) {
366 366
 				foreach ( $variants as $variant ) {
367 367
 					if ( array_key_exists( $variant, $all_variants ) ) {
368
-						$available_variants[] = array(
368
+						$available_variants[ ] = array(
369 369
 							'id' => $variant,
370 370
 							'label' => $all_variants[ $variant ],
371 371
 						);
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 			if ( is_array( $subsets ) ) {
378 378
 				foreach ( $subsets as $subset ) {
379 379
 					if ( array_key_exists( $subset, $all_subsets ) ) {
380
-						$available_subsets[] = array(
380
+						$available_subsets[ ] = array(
381 381
 							'id' => $subset,
382 382
 							'label' => $all_subsets[ $subset ],
383 383
 						);
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 				}
386 386
 			}
387 387
 
388
-			$google_fonts_final[] = array(
388
+			$google_fonts_final[ ] = array(
389 389
 				'family'       => $family,
390 390
 				'label'        => $label,
391 391
 				'variants'     => $available_variants,
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.