Completed
Branch develop (dc9bf0)
by Aristeides
02:58
created
includes/output/class-kirki-output.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 			return;
108 108
 		}
109 109
 		$output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global';
110
-		$output['prefix']      = ( isset( $output['prefix'] ) )      ? $output['prefix']      : '';
111
-		$output['units']       = ( isset( $output['units'] ) )       ? $output['units']       : '';
112
-		$output['suffix']      = ( isset( $output['suffix'] ) )      ? $output['suffix']      : '';
110
+		$output['prefix']      = ( isset( $output['prefix'] ) ) ? $output['prefix'] : '';
111
+		$output['units']       = ( isset( $output['units'] ) ) ? $output['units'] : '';
112
+		$output['suffix']      = ( isset( $output['suffix'] ) ) ? $output['suffix'] : '';
113 113
 
114 114
 		if ( is_array( $output['element'] ) ) {
115 115
 			$output['element'] = array_unique( $output['element'] );
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			$output['element'] = implode( ',', $output['element'] );
118 118
 		}
119 119
 
120
-		$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
120
+		$this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
121 121
 	}
122 122
 
123 123
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			'background-position' => 'Kirki_Output_Property_Background_Position',
138 138
 		) );
139 139
 		if ( array_key_exists( $property, $properties ) ) {
140
-			$classname = $properties[ $property ];
140
+			$classname = $properties[$property];
141 141
 			$obj = new $classname( $property, $value );
142 142
 			return $obj->get_value();
143 143
 		}
Please login to merge, or discard this patch.
includes/styles/class-kirki-styles-frontend.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -105,10 +105,10 @@
 block discarded – undo
105 105
 
106 106
 				// Only continue if $field['output'] is set
107 107
 				if ( isset( $field['output'] ) && ! empty( $field['output'] ) && 'background' != $field['type'] ) {
108
-					$css  = Kirki_Helper::array_replace_recursive( $css, Kirki_Styles_Output_CSS::css( $field ) );
108
+					$css = Kirki_Helper::array_replace_recursive( $css, Kirki_Styles_Output_CSS::css( $field ) );
109 109
 					// Add the globals
110
-					if ( isset( self::$css_array[ $config_id ] ) && ! empty( self::$css_array[ $config_id ] ) ) {
111
-						Kirki_Helper::array_replace_recursive( $css, self::$css_array[ $config_id ] );
110
+					if ( isset( self::$css_array[$config_id] ) && ! empty( self::$css_array[$config_id] ) ) {
111
+						Kirki_Helper::array_replace_recursive( $css, self::$css_array[$config_id] );
112 112
 					}
113 113
 
114 114
 				}
Please login to merge, or discard this patch.
includes/class-kirki-field.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
 			$defaults = get_class_vars( __CLASS__ );
182 182
 			// Get the config arguments, and merge them with the defaults
183 183
 			$config_defaults = ( isset( Kirki::$config['global'] ) ? Kirki::$config['global'] : array();
184
-			if ( 'global' != $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) {
185
-				$config_defaults = Kirki::$config[ $this->kirki_config ];
184
+			if ( 'global' != $this->kirki_config && isset( Kirki::$config[$this->kirki_config] ) ) {
185
+				$config_defaults = Kirki::$config[$this->kirki_config];
186 186
 			}
187 187
 			$config_defaults = ( is_array( $config_defaults ) ) ? $config_defaults : array();
188 188
 			foreach ( $config_defaults as $key => $value ) {
189
-				if ( isset( $defaults[ $key ] ) ) {
190
-					if ( ! empty( $value ) && $value != $defaults[ $key ] ) {
191
-						$defaults[ $key ] = $value;
189
+				if ( isset( $defaults[$key] ) ) {
190
+					if ( ! empty( $value ) && $value != $defaults[$key] ) {
191
+						$defaults[$key] = $value;
192 192
 					}
193 193
 				}
194 194
 			}
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 			// remove any whitelisted properties from above
219 219
 			// These will get a free pass, completely unfiltered.
220 220
 			foreach ( $whitelisted_properties as $key => $default_value ) {
221
-				if ( isset( $properties[ $key ] ) ) {
222
-					unset( $properties[ $key ] );
221
+				if ( isset( $properties[$key] ) ) {
222
+					unset( $properties[$key] );
223 223
 				}
224 224
 			}
225 225
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			// Get all arguments with their values
252 252
 			$args = get_class_vars( __CLASS__ );
253 253
 			foreach ( $args as $key => $default_value ) {
254
-				$args[ $key ] = $this->$key;
254
+				$args[$key] = $this->$key;
255 255
 			}
256 256
 
257 257
 			// add the whitelisted properties through the back door
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 				if ( ! isset( $this->$key ) ) {
260 260
 					$this->$key = $default_value;
261 261
 				}
262
-				$args[ $key ] = $this->$key;
262
+				$args[$key] = $this->$key;
263 263
 			}
264 264
 
265 265
 			// Add the field to the static $fields variable properly indexed
266
-			Kirki::$fields[ $this->settings ] = $args;
266
+			Kirki::$fields[$this->settings] = $args;
267 267
 
268 268
 			if ( 'background' == $this->type ) {
269 269
 				// Build the background fields
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
 			}
361 361
 			$settings = array();
362 362
 			foreach ( $this->settings as $setting_key => $setting_value ) {
363
-				$settings[ sanitize_key( $setting_key ) ] = esc_attr( $setting_value );
363
+				$settings[sanitize_key( $setting_key )] = esc_attr( $setting_value );
364 364
 				// If we're using serialized options then we need to spice this up
365 365
 				if ( 'option' == $this->option_type && '' != $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) {
366
-					$settings[ sanitize_key( $setting_key ) ] = esc_attr( $this->option_name ) . '[' . esc_attr( $setting_value ).']';
366
+					$settings[sanitize_key( $setting_key )] = esc_attr( $this->option_name ) . '[' . esc_attr( $setting_value ) . ']';
367 367
 				}
368 368
 			}
369 369
 			$this->settings = $settings;
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 			);
547 547
 
548 548
 			if ( array_key_exists( $this->type, $default_callbacks ) ) {
549
-				$this->sanitize_callback = $default_callbacks[ $this->type ];
549
+				$this->sanitize_callback = $default_callbacks[$this->type];
550 550
 			}
551 551
 
552 552
 		}
Please login to merge, or discard this patch.
includes/output/control/class-kirki-output-control-typography.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 		// Take care of font-families
10 10
 		if ( isset( $value['font-family'] ) && ! empty( $value['font-family'] ) ) {
11 11
 			$output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global';
12
-			$this->styles[ $output['media_query'] ][ $output['element'] ]['font-family'] = $this->process_property_value( 'font-family', $value['font-family'] );
12
+			$this->styles[$output['media_query']][$output['element']]['font-family'] = $this->process_property_value( 'font-family', $value['font-family'] );
13 13
 		}
14 14
 		// Add support for the older font-weight parameter.
15 15
 		// This has been deprecated so the code below is just
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 		// and make changes to their typography,
19 19
 		// new values are saved and this one is no longer used.
20 20
 		if ( isset( $value['font-weight'] ) && ! empty( $value['font-weight'] ) ) {
21
-			$this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $value['font-weight'];
21
+			$this->styles[$output['media_query']][$output['element']]['font-weight'] = $value['font-weight'];
22 22
 		}
23 23
 		// Take care of variants
24 24
 		if ( isset( $value['variant'] ) && ! empty( $value['variant'] ) ) {
@@ -27,26 +27,26 @@  discard block
 block discarded – undo
27 27
 			$font_weight = ( in_array( $font_weight, array( '', 'regular' ) ) ) ? '400' : $font_weight;
28 28
 			// Is this italic?
29 29
 			$is_italic = ( false !== strpos( $value['variant'], 'italic' ) );
30
-			$this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight;
30
+			$this->styles[$output['media_query']][$output['element']]['font-weight'] = $font_weight;
31 31
 			if ( $is_italic ) {
32
-				$this->styles[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic';
32
+				$this->styles[$output['media_query']][$output['element']]['font-style'] = 'italic';
33 33
 			}
34 34
 		}
35 35
 		// Take care of font-size
36 36
 		if ( isset( $value['font-size'] ) && ! empty( $value['font-size'] ) ) {
37
-			$this->styles[ $output['media_query'] ][ $output['element'] ]['font-size'] = $value['font-size'];
37
+			$this->styles[$output['media_query']][$output['element']]['font-size'] = $value['font-size'];
38 38
 		}
39 39
 		// Take care of line-height
40 40
 		if ( isset( $value['line-height'] ) && ! empty( $value['line-height'] ) ) {
41
-			$this->styles[ $output['media_query'] ][ $output['element'] ]['line-height'] = $value['line-height'];
41
+			$this->styles[$output['media_query']][$output['element']]['line-height'] = $value['line-height'];
42 42
 		}
43 43
 		// Take care of letter-spacing
44 44
 		if ( isset( $value['letter-spacing'] ) && ! empty( $value['letter-spacing'] ) ) {
45
-			$this->styles[ $output['media_query'] ][ $output['element'] ]['letter-spacing'] = $value['letter-spacing'];
45
+			$this->styles[$output['media_query']][$output['element']]['letter-spacing'] = $value['letter-spacing'];
46 46
 		}
47 47
 		// Take care of color
48 48
 		if ( isset( $value['color'] ) && ! empty( $value['color'] ) ) {
49
-			$this->styles[ $output['media_query'] ][ $output['element'] ]['color'] = $value['color'];
49
+			$this->styles[$output['media_query']][$output['element']]['color'] = $value['color'];
50 50
 		}
51 51
 	}
52 52
 
Please login to merge, or discard this patch.
includes/class-kirki-enqueue.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 				$available_variants = array();
100 100
 				foreach ( $variants as $variant ) {
101 101
 					if ( array_key_exists( $variant, $all_variants ) ) {
102
-						$available_variants[] = array( 'id' => $variant, 'label' => $all_variants[ $variant ] );
102
+						$available_variants[] = array( 'id' => $variant, 'label' => $all_variants[$variant] );
103 103
 					}
104 104
 				}
105 105
 
106 106
 				$available_subsets = array();
107 107
 				foreach ( $subsets as $subset ) {
108 108
 					if ( array_key_exists( $subset, $all_subsets ) ) {
109
-						$available_subsets[] = array( 'id' => $subset, 'label' => $all_subsets[ $subset ] );
109
+						$available_subsets[] = array( 'id' => $subset, 'label' => $all_subsets[$subset] );
110 110
 					}
111 111
 				}
112 112
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 			$fields = Kirki::$fields;
148 148
 			foreach ( $fields as $field ) {
149 149
 				if ( isset( $field['transport'] ) && 'postMessage' == $field['transport'] && isset( $field['js_vars'] ) && ! empty( $field['js_vars'] ) && is_array( $field['js_vars'] ) && isset( $field['settings'] ) ) {
150
-					$js_vars_fields[ $field['settings'] ] = $field['js_vars'];
150
+					$js_vars_fields[$field['settings']] = $field['js_vars'];
151 151
 				}
152 152
 			}
153 153
 			wp_localize_script( 'kirki_auto_postmessage', 'js_vars', $js_vars_fields );
Please login to merge, or discard this patch.
includes/class-kirki-helper.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 			}
39 39
 			$count = count( $args );
40 40
 			for ( $i = 1; $i < $count; $i++ ) {
41
-				if ( is_array( $args[ $i ] ) ) {
42
-					$array = self::recurse( $array, $args[ $i ] );
41
+				if ( is_array( $args[$i] ) ) {
42
+					$array = self::recurse( $array, $args[$i] );
43 43
 				}
44 44
 			}
45 45
 			return $array;
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
 		public static function recurse( $array, $array1 ) {
52 52
 			foreach ( $array1 as $key => $value ) {
53 53
 				// create new key in $array, if it is empty or not an array
54
-				if ( ! isset( $array[ $key ] ) || ( isset( $array[ $key ] ) && ! is_array( $array[ $key ] ) ) ) {
55
-					$array[ $key ] = array();
54
+				if ( ! isset( $array[$key] ) || ( isset( $array[$key] ) && ! is_array( $array[$key] ) ) ) {
55
+					$array[$key] = array();
56 56
 				}
57 57
 
58 58
 				// overwrite the value in the base array
59 59
 				if ( is_array( $value ) ) {
60
-					$value = self::recurse( $array[ $key ], $value );
60
+					$value = self::recurse( $array[$key], $value );
61 61
 				}
62
-				$array[ $key ] = $value;
62
+				$array[$key] = $value;
63 63
 			}
64 64
 			return $array;
65 65
 		}
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 			// properly format the array.
117 117
 			$items = array();
118 118
 			foreach ( $posts as $post ) {
119
-				$items[ $post->ID ] = $post->post_title;
119
+				$items[$post->ID] = $post->post_title;
120 120
 			}
121 121
 
122 122
 			return $items;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 			foreach ( $taxonomies as $taxonomy ) {
134 134
 				$id           = $taxonomy;
135 135
 				$taxonomy     = get_taxonomy( $taxonomy );
136
-				$items[ $id ] = $taxonomy->labels->name;
136
+				$items[$id] = $taxonomy->labels->name;
137 137
 			}
138 138
 
139 139
 			return $items;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			$post_types = get_post_types( array( 'public' => true ), 'objects' );
149 149
 			// Build the array
150 150
 			foreach ( $post_types as $post_type ) {
151
-				$items[ $post_type->name ] = $post_type->labels->name;
151
+				$items[$post_type->name] = $post_type->labels->name;
152 152
 			}
153 153
 
154 154
 			return $items;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 			$terms = get_terms( $taxonomies );
164 164
 			// Build the array
165 165
 			foreach ( $terms as $term ) {
166
-				$items[ $term->term_id ] = $term->name;
166
+				$items[$term->term_id] = $term->name;
167 167
 			}
168 168
 
169 169
 			return $items;
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 					unset( $colors['primary'] );
270 270
 					$position_colors = array();
271 271
 					foreach ( $colors as $color_family ) {
272
-						if ( isset( $color_family[ $key ] ) ) {
273
-							$position_colors[] = $color_family[ $key ];
272
+						if ( isset( $color_family[$key] ) ) {
273
+							$position_colors[] = $color_family[$key];
274 274
 						}
275 275
 					}
276 276
 					return $position_colors;
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 				case 'primary':
287 287
 					return $colors['primary'];
288 288
 				default:
289
-					if ( isset( $colors[ $context ] ) ) {
290
-						return $colors[ $context ];
289
+					if ( isset( $colors[$context] ) ) {
290
+						return $colors[$context];
291 291
 					}
292 292
 					return $colors['primary'];
293 293
 			}
Please login to merge, or discard this patch.
includes/class-kirki-fonts-google.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 					}
100 100
 				}
101 101
 				// Add the requested google-font
102
-				if ( ! isset( $this->fonts[ $value['font-family'] ] ) ) {
103
-					$this->fonts[ $value['font-family'] ] = array();
102
+				if ( ! isset( $this->fonts[$value['font-family']] ) ) {
103
+					$this->fonts[$value['font-family']] = array();
104 104
 				}
105
-				if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ] ) ) {
106
-					$this->fonts[ $value['font-family'] ][] = $value['variant'];
105
+				if ( ! in_array( $value['variant'], $this->fonts[$value['font-family']] ) ) {
106
+					$this->fonts[$value['font-family']][] = $value['variant'];
107 107
 				}
108 108
 			}
109 109
 
@@ -123,14 +123,14 @@  discard block
 block discarded – undo
123 123
 						// font-family
124 124
 						if ( 'font-family' == $output['property'] ) {
125 125
 							if ( ! array_key_exists( $value, $this->fonts ) ) {
126
-								$this->fonts[ $value ] = array();
126
+								$this->fonts[$value] = array();
127 127
 							}
128 128
 						}
129 129
 						// font-weight
130 130
 						elseif ( 'font-weight' == $output['property'] ) {
131 131
 							foreach ( $this->fonts as $font => $variants ) {
132 132
 								if ( ! in_array( $value, $variants ) ) {
133
-									$this->fonts[ $font ][] = $value;
133
+									$this->fonts[$font][] = $value;
134 134
 								}
135 135
 							}
136 136
 						}
@@ -167,28 +167,28 @@  discard block
 block discarded – undo
167 167
 				// Determine if this is indeed a google font or not.
168 168
 				// If it's not, then just remove it from the array.
169 169
 				if ( ! array_key_exists( $font, $google_fonts ) ) {
170
-					unset( $this->fonts[ $font ] );
170
+					unset( $this->fonts[$font] );
171 171
 					continue;
172 172
 				}
173 173
 				// Get all valid font variants for this font
174 174
 				$font_variants = array();
175
-				if ( isset( $google_fonts[ $font ]['variants'] ) ) {
176
-					$font_variants = $google_fonts[ $font ]['variants'];
175
+				if ( isset( $google_fonts[$font]['variants'] ) ) {
176
+					$font_variants = $google_fonts[$font]['variants'];
177 177
 				}
178 178
 				foreach ( $variants as $variant ) {
179 179
 					// If this is not a valid variant for this font-family
180 180
 					// then unset it and move on to the next one.
181 181
 					if ( ! in_array( $variant, $font_variants ) ) {
182
-						$variant_key = array_search( $variant, $this->fonts[ $font ] );
183
-						unset( $this->fonts[ $font ][ $variant_key ] );
182
+						$variant_key = array_search( $variant, $this->fonts[$font] );
183
+						unset( $this->fonts[$font][$variant_key] );
184 184
 						continue;
185 185
 					}
186 186
 				}
187 187
 				// Check if the selected subsets exist, even in one of the selected fonts.
188 188
 				// If they don't, then they have to be removed otherwise the link will fail.
189
-				if ( isset( $google_fonts[ $font ]['subsets'] ) ) {
189
+				if ( isset( $google_fonts[$font]['subsets'] ) ) {
190 190
 					foreach ( $this->subsets as $subset ) {
191
-						if ( in_array( $subset, $google_fonts[ $font ]['subsets'] ) ) {
191
+						if ( in_array( $subset, $google_fonts[$font]['subsets'] ) ) {
192 192
 							$valid_subsets[] = $subset;
193 193
 						}
194 194
 					}
Please login to merge, or discard this patch.