Completed
Pull Request — master (#1653)
by Aristeides
04:20 queued 02:06
created
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 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
 	 * Returns an array of paths where translation files may be located.
94 94
 	 *
95 95
 	 * @access protected
96
-	 * @return array
96
+	 * @return string[]
97 97
 	 */
98 98
 	protected function get_paths() {
99 99
 
Please login to merge, or discard this 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.
controls/php/class-kirki-control-typography.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 
53 53
 		if ( is_array( $this->json['value'] ) ) {
54 54
 			foreach ( array_keys( $this->json['value'] ) as $key ) {
55
-				if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json['default'][ $key ] ) ) {
56
-					unset( $this->json['value'][ $key ] );
55
+				if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json['default'][$key] ) ) {
56
+					unset( $this->json['value'][$key] );
57 57
 				}
58 58
 				// Fix for https://github.com/aristath/kirki/issues/1405.
59
-				if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) {
60
-					unset( $this->json['value'][ $key ] );
59
+				if ( isset( $this->json['default'][$key] ) && false === $this->json['default'][$key] ) {
60
+					unset( $this->json['value'][$key] );
61 61
 				}
62 62
 			}
63 63
 		}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 			if ( is_string( $variant ) ) {
258 258
 				$final_variants[] = array(
259 259
 					'id'    => $variant,
260
-					'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant,
260
+					'label' => isset( $all_variants[$variant] ) ? $all_variants[$variant] : $variant,
261 261
 				);
262 262
 			} elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) {
263 263
 				$final_variants[] = $variant;
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 					if ( array_key_exists( $variant, $all_variants ) ) {
339 339
 						$available_variants[] = array(
340 340
 							'id' => $variant,
341
-							'label' => $all_variants[ $variant ],
341
+							'label' => $all_variants[$variant],
342 342
 						);
343 343
 					}
344 344
 				}
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 					if ( array_key_exists( $subset, $all_subsets ) ) {
351 351
 						$available_subsets[] = array(
352 352
 							'id' => $subset,
353
-							'label' => $all_subsets[ $subset ],
353
+							'label' => $all_subsets[$subset],
354 354
 						);
355 355
 					}
356 356
 				}
Please login to merge, or discard this patch.
docs/files/class-my-theme-kirki.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -73,23 +73,23 @@  discard block
 block discarded – undo
73 73
 		// Kirki does not exist, continue with our custom implementation.
74 74
 		// Get the default value of the field.
75 75
 		$default = '';
76
-		if ( isset( self::$fields[ $field_id ] ) && isset( self::$fields[ $field_id ]['default'] ) ) {
77
-			$default = self::$fields[ $field_id ]['default'];
76
+		if ( isset( self::$fields[$field_id] ) && isset( self::$fields[$field_id]['default'] ) ) {
77
+			$default = self::$fields[$field_id]['default'];
78 78
 		}
79 79
 
80 80
 		// Make sure the config is defined.
81
-		if ( isset( self::$config[ $config_id ] ) ) {
82
-			if ( 'option' == self::$config[ $config_id ]['option_type'] ) {
81
+		if ( isset( self::$config[$config_id] ) ) {
82
+			if ( 'option' == self::$config[$config_id]['option_type'] ) {
83 83
 
84 84
 				// check if we're using serialized options.
85
-				if ( isset( self::$config[ $config_id ]['option_name'] ) && ! empty( self::$config[ $config_id ]['option_name'] ) ) {
85
+				if ( isset( self::$config[$config_id]['option_name'] ) && ! empty( self::$config[$config_id]['option_name'] ) ) {
86 86
 
87 87
 					// Get all our options.
88
-					$all_options = get_option( self::$config[ $config_id ]['option_name'], array() );
88
+					$all_options = get_option( self::$config[$config_id]['option_name'], array() );
89 89
 
90 90
 					// If our option is not saved, return the default value.
91 91
 					// If option was set, return its value unserialized.
92
-					return ( ! isset( $all_options[ $field_id ] ) ) ? $default : maybe_unserialize( $all_options[ $field_id ] );
92
+					return ( ! isset( $all_options[$field_id] ) ) ? $default : maybe_unserialize( $all_options[$field_id] );
93 93
 				}
94 94
 
95 95
 				// If we're not using serialized options, get the value and return it.
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 		}
149 149
 
150 150
 		// Kirki does not exist, set the config arguments.
151
-		$config[ $config_id ] = $args;
151
+		$config[$config_id] = $args;
152 152
 
153 153
 		// Make sure an option_type is defined.
154
-		if ( ! isset( self::$config[ $config_id ]['option_type'] ) ) {
155
-			self::$config[ $config_id ]['option_type'] = 'theme_mod';
154
+		if ( ! isset( self::$config[$config_id]['option_type'] ) ) {
155
+			self::$config[$config_id]['option_type'] = 'theme_mod';
156 156
 		}
157 157
 	}
158 158
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 			if ( ! isset( $args['kirki_config'] ) ) {
181 181
 				$args['kirki_config'] = $config_id;
182 182
 			}
183
-			self::$fields[ $args['settings'] ] = $args;
183
+			self::$fields[$args['settings']] = $args;
184 184
 		}
185 185
 	}
186 186
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 				if ( ! is_array( $value ) ) {
265 265
 					$value = str_replace( '$', $value, $output['value_pattern'] );
266 266
 					if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) ) {
267
-						$css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
267
+						$css[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
268 268
 					}
269 269
 				} else {
270 270
 					if ( 'typography' === $field['type'] ) {
@@ -278,27 +278,27 @@  discard block
 block discarded – undo
278 278
 
279 279
 							// Add double quotes if needed to font-families.
280 280
 							if ( 'font-family' == $key && false !== strpos( $subvalue, ' ' ) && false === strpos( $subvalue, '"' ) ) {
281
-								$css[ $output['media_query'] ][ $output['element'] ]['font-family'] = '"' . $subvalue . '"';
281
+								$css[$output['media_query']][$output['element']]['font-family'] = '"' . $subvalue . '"';
282 282
 							}
283 283
 
284 284
 							// Variants contain both font-weight & italics.
285 285
 							if ( 'variant' === $key ) {
286 286
 								$font_weight = str_replace( 'italic', '', $subvalue );
287 287
 								$font_weight = ( in_array( $font_weight, array( '', 'regular' ) ) ) ? '400' : $font_weight;
288
-								$css[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight;
288
+								$css[$output['media_query']][$output['element']]['font-weight'] = $font_weight;
289 289
 
290 290
 								// Is this italic?
291 291
 								if ( false !== strpos( $subvalue, 'italic' ) ) {
292
-									$css[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic';
292
+									$css[$output['media_query']][$output['element']]['font-style'] = 'italic';
293 293
 								}
294 294
 							} else {
295
-								$css[ $output['media_query'] ][ $output['element'] ][ $key ] = $subvalue;
295
+								$css[$output['media_query']][$output['element']][$key] = $subvalue;
296 296
 							}
297 297
 						}
298 298
 					} elseif ( 'multicolor' == $field['type'] ) {
299 299
 
300 300
 						if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) && ! empty( $output['choice'] ) ) {
301
-							$css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value[ $output['choice'] ] . $output['units'] . $output['suffix'];
301
+							$css[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value[$output['choice']] . $output['units'] . $output['suffix'];
302 302
 						}
303 303
 					} else {
304 304
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 								$subvalue = 'url("' . $subvalue . '")';
314 314
 							}
315 315
 							if ( $subvalue ) {
316
-								$css[ $output['media_query'] ][ $output['element'] ][ $property ] = $subvalue;
316
+								$css[$output['media_query']][$output['element']][$property] = $subvalue;
317 317
 							}
318 318
 						}
319 319
 					}
Please login to merge, or discard this patch.
docs/files/class-kirki-installer-section.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,11 @@
 block discarded – undo
55 55
 						<a class="install-now button-primary button" data-slug="kirki" href="<?php echo esc_url_raw( $plugin_install_url ); ?>" aria-label="<?php esc_attr_e( 'Install Kirki Toolkit now', 'textdomain' ); ?>" data-name="Kirki Toolkit">
56 56
 							<?php esc_html_e( 'Install Now', 'textdomain' ); ?>
57 57
 						</a>
58
-					<?php else : ?>
59
-						<p style="text-align:left;margin-top:0;"><?php esc_attr_e( 'You have installed Kirki. Activate it to take advantage of this theme\'s features in the customizer.', 'textdomain' ); ?></p>
58
+					<?php else {
59
+	: ?>
60
+						<p style="text-align:left;margin-top:0;"><?php esc_attr_e( 'You have installed Kirki. Activate it to take advantage of this theme\'s features in the customizer.', 'textdomain' );
61
+}
62
+?></p>
60 63
 						<a class="install-now button-secondary button change-theme" data-slug="kirki" href="<?php echo esc_url_raw( self_admin_url( 'plugins.php' ) ); ?>" aria-label="<?php esc_attr_e( 'Activate Kirki Toolkit now', 'textdomain' ); ?>" data-name="Kirki Toolkit">
61 64
 							<?php esc_html_e( 'Activate Now', 'textdomain' ); ?>
62 65
 						</a>
Please login to merge, or discard this patch.
modules/postmessage/class-kirki-modules-postmessage.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
 			$js_var['index_key'] = $key;
143 143
 			$callback = $this->get_callback( $args );
144 144
 			if ( is_callable( $callback ) ) {
145
-				$field['scripts'][ $key ] = call_user_func_array( $callback, array( $js_var, $args ) );
145
+				$field['scripts'][$key] = call_user_func_array( $callback, array( $js_var, $args ) );
146 146
 				continue;
147 147
 			}
148
-			$field['scripts'][ $key ] = $this->script_var( $js_var );
148
+			$field['scripts'][$key] = $this->script_var( $js_var );
149 149
 		}
150 150
 		$combo_extra_script = '';
151 151
 		$combo_css_script   = '';
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	protected function script_html_var( $args ) {
179 179
 
180
-		$script  = ( isset( $args['choice'] ) ) ? "newval=newval['{$args['choice']}'];" : '';
180
+		$script = ( isset( $args['choice'] ) ) ? "newval=newval['{$args['choice']}'];" : '';
181 181
 
182 182
 		// Apply the value_pattern.
183 183
 		if ( isset( $args['value_pattern'] ) && '' !== $args['value_pattern'] ) {
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 		$property_script = '';
252 252
 
253 253
 		// Define choice.
254
-		$choice  = ( isset( $args['choice'] ) && '' !== $args['choice'] ) ? $args['choice'] : '';
254
+		$choice = ( isset( $args['choice'] ) && '' !== $args['choice'] ) ? $args['choice'] : '';
255 255
 
256 256
 		$value_key = 'newval' . $args['index_key'];
257 257
 		$property_script .= $value_key . '=newval;';
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 			'font-weight'    => 'fontWeight',
345 345
 			'font-style'     => 'fontStyle',
346 346
 		);
347
-		$choice_condition = ( isset( $args['choice'] ) && '' !== $args['choice'] && isset( $css_build_array[ $args['choice'] ] ) );
347
+		$choice_condition = ( isset( $args['choice'] ) && '' !== $args['choice'] && isset( $css_build_array[$args['choice']] ) );
348 348
 		$script .= ( ! $choice_condition ) ? $webfont_loader : '';
349 349
 		foreach ( $css_build_array as $property => $var ) {
350 350
 			if ( $choice_condition && $property !== $args['choice'] ) {
Please login to merge, or discard this patch.
modules/css/class-kirki-output.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 			}
102 102
 			if ( is_array( $value ) ) {
103 103
 				foreach ( array_keys( $value ) as $value_k ) {
104
-					if ( ! is_string( $value[ $value_k ] ) ) {
104
+					if ( ! is_string( $value[$value_k] ) ) {
105 105
 						continue;
106 106
 					}
107 107
 					if ( isset( $output['choice'] ) ) {
108 108
 						if ( $output['choice'] === $value_k ) {
109
-							$value[ $output['choice'] ] = str_replace( '$', $value[ $output['choice'] ], $output['value_pattern'] );
109
+							$value[$output['choice']] = str_replace( '$', $value[$output['choice']], $output['value_pattern'] );
110 110
 						}
111 111
 						continue;
112 112
 					}
113
-					$value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output['value_pattern'] );
113
+					$value[$value_k] = str_replace( '$', $value[$value_k], $output['value_pattern'] );
114 114
 				}
115 115
 			}
116 116
 			$value = $this->apply_pattern_replace( $output, $value );
@@ -140,16 +140,16 @@  discard block
 block discarded – undo
140 140
 						if ( is_array( $options ) ) {
141 141
 							if ( $option_name ) {
142 142
 								$subkey = str_replace( array( $option_name, '[', ']' ), '', $replace );
143
-								$replacement = ( isset( $options[ $subkey ] ) ) ? $options[ $subkey ] : '';
143
+								$replacement = ( isset( $options[$subkey] ) ) ? $options[$subkey] : '';
144 144
 								break;
145 145
 							}
146
-							$replacement = ( isset( $options[ $replace ] ) ) ? $options[ $replace ] : '';
146
+							$replacement = ( isset( $options[$replace] ) ) ? $options[$replace] : '';
147 147
 							break;
148 148
 						}
149 149
 						$replacement = get_option( $replace );
150 150
 						break;
151 151
 					case 'site_option':
152
-						$replacement = ( is_array( $options ) && isset( $options[ $replace ] ) ) ? $options[ $replace ] : get_site_option( $replace );
152
+						$replacement = ( is_array( $options ) && isset( $options[$replace] ) ) ? $options[$replace] : get_site_option( $replace );
153 153
 						break;
154 154
 					case 'user_meta':
155 155
 						$user_id = get_current_user_id();
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 				$replacement = ( false === $replacement ) ? '' : $replacement;
165 165
 				if ( is_array( $value ) ) {
166 166
 					foreach ( $value as $k => $v ) {
167
-						if ( isset( $value[ $v ] ) ) {
168
-							$value[ $k ] = str_replace( $search, $replacement, $value[ $v ] );
167
+						if ( isset( $value[$v] ) ) {
168
+							$value[$k] = str_replace( $search, $replacement, $value[$v] );
169 169
 						} else {
170
-							$value[ $k ] = str_replace( $search, $replacement, $v );
170
+							$value[$k] = str_replace( $search, $replacement, $v );
171 171
 						}
172 172
 					}
173 173
 					return $value;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 						}
211 211
 						// If 'choice' is defined check for sub-values too.
212 212
 						// Fixes https://github.com/aristath/kirki/issues/1416.
213
-						if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) {
213
+						if ( isset( $output['choice'] ) && isset( $value[$output['choice']] ) && $exclude == $value[$output['choice']] ) {
214 214
 							$skip = true;
215 215
 						}
216 216
 					}
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
 			'background',
269 269
 		);
270 270
 		if ( in_array( $output['property'], $accepts_multiple, true ) ) {
271
-			if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) {
272
-				$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ];
271
+			if ( isset( $this->styles[$output['media_query']][$output['element']][$output['property']] ) && ! is_array( $this->styles[$output['media_query']][$output['element']][$output['property']] ) ) {
272
+				$this->styles[$output['media_query']][$output['element']][$output['property']] = (array) $this->styles[$output['media_query']][$output['element']][$output['property']];
273 273
 			}
274
-			$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
274
+			$this->styles[$output['media_query']][$output['element']][$output['property']][] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
275 275
 			return;
276 276
 		}
277
-		$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix'];
277
+		$this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix'];
278 278
 	}
279 279
 
280 280
 	/**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 			)
297 297
 		);
298 298
 		if ( array_key_exists( $property, $properties ) ) {
299
-			$classname = $properties[ $property ];
299
+			$classname = $properties[$property];
300 300
 			$obj = new $classname( $property, $value );
301 301
 			return $obj->get_value();
302 302
 		}
Please login to merge, or discard this patch.