Completed
Pull Request — master (#1653)
by Aristeides
09:38 queued 04:44
created
modules/webfonts/class-kirki-fonts-google.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
 			}
142 142
 
143 143
 			// Add the requested google-font.
144
-			if ( ! isset( $this->fonts[ $value['font-family'] ] ) ) {
145
-				$this->fonts[ $value['font-family'] ] = array();
144
+			if ( ! isset( $this->fonts[$value['font-family']] ) ) {
145
+				$this->fonts[$value['font-family']] = array();
146 146
 			}
147
-			if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ], true ) ) {
148
-				$this->fonts[ $value['font-family'] ][] = $value['variant'];
147
+			if ( ! in_array( $value['variant'], $this->fonts[$value['font-family']], true ) ) {
148
+				$this->fonts[$value['font-family']][] = $value['variant'];
149 149
 			}
150 150
 			// Are we force-loading all variants?
151 151
 			if ( true === self::$force_load_all_variants ) {
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 			if ( ! empty( $args['choices']['variant'] ) && is_array( $args['choices']['variant'] ) ) {
157 157
 				foreach ( $args['choices']['variant'] as $extra_variant ) {
158
-					$this->fonts[ $value['font-family'] ][] = $extra_variant;
158
+					$this->fonts[$value['font-family']][] = $extra_variant;
159 159
 				}
160 160
 			}
161 161
 		} else {
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
 					if ( is_string( $value ) ) {
176 176
 						if ( 'font-family' === $output['property'] ) {
177 177
 							if ( ! array_key_exists( $value, $this->fonts ) ) {
178
-								$this->fonts[ $value ] = array();
178
+								$this->fonts[$value] = array();
179 179
 							}
180 180
 						} elseif ( 'font-weight' === $output['property'] ) {
181 181
 							foreach ( $this->fonts as $font => $variants ) {
182 182
 								if ( ! in_array( $value, $variants, true ) ) {
183
-									$this->fonts[ $font ][] = $value;
183
+									$this->fonts[$font][] = $value;
184 184
 								}
185 185
 							}
186 186
 						} elseif ( 'font-subset' === $output['property'] || 'subset' === $output['property'] || 'subsets' === $output['property'] ) {
@@ -220,31 +220,31 @@  discard block
 block discarded – undo
220 220
 			// Determine if this is indeed a google font or not.
221 221
 			// If it's not, then just remove it from the array.
222 222
 			if ( ! array_key_exists( $font, $this->google_fonts ) ) {
223
-				unset( $this->fonts[ $font ] );
223
+				unset( $this->fonts[$font] );
224 224
 				continue;
225 225
 			}
226 226
 
227 227
 			// Get all valid font variants for this font.
228 228
 			$font_variants = array();
229
-			if ( isset( $this->google_fonts[ $font ]['variants'] ) ) {
230
-				$font_variants = $this->google_fonts[ $font ]['variants'];
229
+			if ( isset( $this->google_fonts[$font]['variants'] ) ) {
230
+				$font_variants = $this->google_fonts[$font]['variants'];
231 231
 			}
232 232
 			foreach ( $variants as $variant ) {
233 233
 
234 234
 				// If this is not a valid variant for this font-family
235 235
 				// then unset it and move on to the next one.
236 236
 				if ( ! in_array( $variant, $font_variants, true ) ) {
237
-					$variant_key = array_search( $variant, $this->fonts[ $font ], true );
238
-					unset( $this->fonts[ $font ][ $variant_key ] );
237
+					$variant_key = array_search( $variant, $this->fonts[$font], true );
238
+					unset( $this->fonts[$font][$variant_key] );
239 239
 					continue;
240 240
 				}
241 241
 			}
242 242
 
243 243
 			// Check if the selected subsets exist, even in one of the selected fonts.
244 244
 			// If they don't, then they have to be removed otherwise the link will fail.
245
-			if ( isset( $this->google_fonts[ $font ]['subsets'] ) ) {
245
+			if ( isset( $this->google_fonts[$font]['subsets'] ) ) {
246 246
 				foreach ( $this->subsets as $subset ) {
247
-					if ( in_array( $subset, $this->google_fonts[ $font ]['subsets'], true ) ) {
247
+					if ( in_array( $subset, $this->google_fonts[$font]['subsets'], true ) ) {
248 248
 						$valid_subsets[] = $subset;
249 249
 					}
250 250
 				}
Please login to merge, or discard this patch.
controls/php/class-kirki-settings-repeater-setting.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,9 +67,9 @@
 block discarded – undo
67 67
 
68 68
 		// Make sure that every row is an array, not an object.
69 69
 		foreach ( $sanitized as $key => $_value ) {
70
-			$sanitized[ $key ] = (array) $_value;
70
+			$sanitized[$key] = (array) $_value;
71 71
 			if ( empty( $_value ) ) {
72
-				unset( $sanitized[ $key ] );
72
+				unset( $sanitized[$key] );
73 73
 			}
74 74
 		}
75 75
 
Please login to merge, or discard this patch.
controls/php/class-kirki-control-repeater.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 
112 112
 		foreach ( $args['fields'] as $key => $value ) {
113 113
 			if ( ! isset( $value['default'] ) ) {
114
-				$args['fields'][ $key ]['default'] = '';
114
+				$args['fields'][$key]['default'] = '';
115 115
 			}
116 116
 			if ( ! isset( $value['label'] ) ) {
117
-				$args['fields'][ $key ]['label'] = '';
117
+				$args['fields'][$key]['label'] = '';
118 118
 			}
119
-			$args['fields'][ $key ]['id']      = $key;
119
+			$args['fields'][$key]['id'] = $key;
120 120
 
121 121
 			// We check if the filed is an uploaded media ( image , file, video, etc.. ).
122 122
 			if ( isset( $value['type'] ) ) {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 					case 'cropped_image':
126 126
 					case 'upload':
127 127
 						// We add it to the list of fields that need some extra filtering/processing.
128
-						$media_fields_to_filter[ $key ] = true;
128
+						$media_fields_to_filter[$key] = true;
129 129
 						break;
130 130
 
131 131
 					case 'dropdown-pages':
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 							)
141 141
 						);
142 142
 						// Hackily add in the data link parameter.
143
-						$dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][ $key ]['id'] ) . '"' . $this->get_link(), $dropdown );
144
-						$args['fields'][ $key ]['dropdown'] = $dropdown;
143
+						$dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][$key]['id'] ) . '"' . $this->get_link(), $dropdown );
144
+						$args['fields'][$key]['dropdown'] = $dropdown;
145 145
 						break;
146 146
 				}
147 147
 			}
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 			}
582 582
 
583 583
 			// Validating row label field.
584
-			if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][ esc_attr( $args['row_label']['field'] ) ] ) ) {
584
+			if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][esc_attr( $args['row_label']['field'] )] ) ) {
585 585
 				$this->row_label['field'] = esc_attr( $args['row_label']['field'] );
586 586
 			} else {
587 587
 				// If from field is not set correctly, making sure standard is set as the type.
Please login to merge, or discard this patch.
controls/php/class-kirki-control-dimensions.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,14 +79,14 @@
 block discarded – undo
79 79
 		if ( is_array( $this->choices ) ) {
80 80
 			foreach ( $this->choices as $choice => $value ) {
81 81
 				if ( 'labels' !== $choice && true === $value ) {
82
-					$this->json['choices'][ $choice ] = true;
82
+					$this->json['choices'][$choice] = true;
83 83
 				}
84 84
 			}
85 85
 		}
86 86
 		if ( is_array( $this->json['default'] ) ) {
87 87
 			foreach ( $this->json['default'] as $key => $value ) {
88
-				if ( isset( $this->json['choices'][ $key ] ) && ! isset( $this->json['value'][ $key ] ) ) {
89
-					$this->json['value'][ $key ] = $value;
88
+				if ( isset( $this->json['choices'][$key] ) && ! isset( $this->json['value'][$key] ) ) {
89
+					$this->json['value'][$key] = $value;
90 90
 				}
91 91
 			}
92 92
 		}
Please login to merge, or discard this patch.
modules/css/field/class-kirki-output-field-multicolor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 			$output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : '';
48 48
 
49 49
 			// Create the styles.
50
-			$this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $sub_value . $output['suffix'];
50
+			$this->styles[$output['media_query']][$output['element']][$property] = $sub_value . $output['suffix'];
51 51
 
52 52
 		}
53 53
 	}
Please login to merge, or discard this patch.
core/class-kirki-l10n.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,9 +117,9 @@
 block discarded – undo
117 117
 	public function override_load_textdomain( $override, $domain, $mofile ) {
118 118
 
119 119
 		global $l10n;
120
-		if ( isset( $l10n[ $this->get_theme_textdomain() ] ) ) {
120
+		if ( isset( $l10n[$this->get_theme_textdomain()] ) ) {
121 121
 			// @codingStandardsIgnoreLine WordPress.Variables.GlobalVariables.OverrideProhibited
122
-			$l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ];
122
+			$l10n['kirki'] = $l10n[$this->get_theme_textdomain()];
123 123
 		}
124 124
 
125 125
 		// Check if the domain is "kirki".
Please login to merge, or discard this patch.
controls/php/class-kirki-control-background.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -200,10 +200,13 @@
 block discarded – undo
200 200
 			</div>
201 201
 			<?php if ( Kirki_Util::get_wp_version() >= 4.9 ) : ?>
202 202
 				<input class="background-hidden-value" type="hidden" {{{ data.link }}}>
203
-			<?php else : ?>
203
+			<?php else {
204
+	: ?>
204 205
 				<# valueJSON = JSON.stringify( data.value ).replace( /'/g, '&#39' ); #>
205 206
 				<input class="background-hidden-value" type="hidden" value='{{{ valueJSON }}}' {{{ data.link }}}>
206
-			<?php endif; ?>
207
+			<?php endif;
208
+}
209
+?>
207 210
 		<?php
208 211
 	}
209 212
 }
Please login to merge, or discard this patch.
class-kirki-autoload.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 		}
55 55
 
56 56
 		// Check if we've got it cached and ready.
57
-		if ( isset( $this->cached_paths[ $class_name ] ) && file_exists( $this->cached_paths[ $class_name ] ) ) {
58
-			include_once $this->cached_paths[ $class_name ];
57
+		if ( isset( $this->cached_paths[$class_name] ) && file_exists( $this->cached_paths[$class_name] ) ) {
58
+			include_once $this->cached_paths[$class_name];
59 59
 			return;
60 60
 		}
61 61
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		foreach ( $paths as $path ) {
65 65
 			$path = wp_normalize_path( $path );
66 66
 			if ( file_exists( $path ) ) {
67
-				$this->cached_paths[ $class_name ] = $path;
67
+				$this->cached_paths[$class_name] = $path;
68 68
 				include_once $path;
69 69
 				return;
70 70
 			}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
 			// Handle controls loading.
101 101
 			if ( 'Control' === $name_parts[0] || 'Settings' === $name_parts[0] ) {
102
-				$path  = dirname( __FILE__ ) . '/controls/php/';
102
+				$path = dirname( __FILE__ ) . '/controls/php/';
103 103
 				$paths[] = $path . $filename;
104 104
 			}
105 105
 		}
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$previous_path = '';
115 115
 		for ( $i = 0; $i < $levels; $i++ ) {
116
-			$paths[] = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[ $i ] ) . '/' . $filename;
117
-			$previous_path .= strtolower( $exploded[ $i ] ) . '/';
116
+			$paths[] = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[$i] ) . '/' . $filename;
117
+			$previous_path .= strtolower( $exploded[$i] ) . '/';
118 118
 		}
119 119
 		return $paths;
120 120
 	}
Please login to merge, or discard this patch.
core/class-kirki-field.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -257,13 +257,13 @@  discard block
 block discarded – undo
257 257
 
258 258
 		// Get the config arguments, and merge them with the defaults.
259 259
 		$config_defaults = ( isset( Kirki::$config['global'] ) ) ? Kirki::$config['global'] : array();
260
-		if ( 'global' !== $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) {
261
-			$config_defaults = Kirki::$config[ $this->kirki_config ];
260
+		if ( 'global' !== $this->kirki_config && isset( Kirki::$config[$this->kirki_config] ) ) {
261
+			$config_defaults = Kirki::$config[$this->kirki_config];
262 262
 		}
263 263
 		$config_defaults = ( is_array( $config_defaults ) ) ? $config_defaults : array();
264 264
 		foreach ( $config_defaults as $key => $value ) {
265
-			if ( isset( $defaults[ $key ] ) && ! empty( $value ) && $value !== $defaults[ $key ] ) {
266
-				$defaults[ $key ] = $value;
265
+			if ( isset( $defaults[$key] ) && ! empty( $value ) && $value !== $defaults[$key] ) {
266
+				$defaults[$key] = $value;
267 267
 			}
268 268
 		}
269 269
 
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
 		// Get all arguments with their values.
309 309
 		$args = get_object_vars( $this );
310 310
 		foreach ( array_keys( $args ) as $key ) {
311
-			$args[ $key ] = $this->$key;
311
+			$args[$key] = $this->$key;
312 312
 		}
313 313
 
314 314
 		// Add the field to the static $fields variable properly indexed.
315
-		Kirki::$fields[ $this->settings ] = $args;
315
+		Kirki::$fields[$this->settings] = $args;
316 316
 
317 317
 	}
318 318
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 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
-				unset( $this->partial_refresh[ $id ] );
410
+				unset( $this->partial_refresh[$id] );
411 411
 				continue;
412 412
 			}
413 413
 		}
@@ -435,10 +435,10 @@  discard block
 block discarded – undo
435 435
 		}
436 436
 		$settings = array();
437 437
 		foreach ( $this->settings as $setting_key => $setting_value ) {
438
-			$settings[ $setting_key ] = $setting_value;
438
+			$settings[$setting_key] = $setting_value;
439 439
 			// If we're using serialized options then we need to spice this up.
440 440
 			if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) {
441
-				$settings[ $setting_key ] = "{$this->option_name}[{$setting_value}]";
441
+				$settings[$setting_key] = "{$this->option_name}[{$setting_value}]";
442 442
 			}
443 443
 		}
444 444
 		$this->settings = $settings;
@@ -550,27 +550,27 @@  discard block
 block discarded – undo
550 550
 		}
551 551
 		foreach ( $this->output as $key => $output ) {
552 552
 			if ( empty( $output ) || ! isset( $output['element'] ) ) {
553
-				unset( $this->output[ $key ] );
553
+				unset( $this->output[$key] );
554 554
 				continue;
555 555
 			}
556 556
 			if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) {
557
-				$this->output[ $key ]['sanitize_callback'] = $output['callback'];
557
+				$this->output[$key]['sanitize_callback'] = $output['callback'];
558 558
 			}
559 559
 			// Convert element arrays to strings.
560 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'] );
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
 
Please login to merge, or discard this patch.