Completed
Pull Request — master (#1653)
by Aristeides
04:20 queued 02:25
created
modules/css/field/class-kirki-output-field-typography.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
 		);
45 45
 
46 46
 		foreach ( $properties as $property ) {
47
-			if ( ! isset( $value[ $property ] ) || ! $value[ $property ] ) {
47
+			if ( ! isset( $value[$property] ) || ! $value[$property] ) {
48 48
 				continue;
49 49
 			}
50 50
 			if ( isset( $output['choice'] ) && $output['choice'] !== $property ) {
51 51
 				continue;
52 52
 			}
53 53
 
54
-			$property_value = $this->process_property_value( $property, $value[ $property ] );
54
+			$property_value = $this->process_property_value( $property, $value[$property] );
55 55
 			if ( 'font-family' === $property ) {
56 56
 				$value['font-backup'] = ( isset( $value['font-backup'] ) ) ? $value['font-backup'] : '';
57 57
 				$property_value = $this->process_property_value( $property, array(
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			}
62 62
 			$property = ( isset( $output['choice'] ) && isset( $output['property'] ) ) ? $output['property'] : $property;
63 63
 			$property_value = ( is_array( $property_value ) && isset( $property_value[0] ) ) ? $property_value[0] : $property_value;
64
-			$this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $property_value . $output['suffix'];
64
+			$this->styles[$output['media_query']][$output['element']][$property] = $output['prefix'] . $property_value . $output['suffix'];
65 65
 		}
66 66
 	}
67 67
 }
Please login to merge, or discard this patch.
core/class-kirki-init.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$this->control_types = $this->default_control_types();
168 168
 		foreach ( $this->control_types as $key => $classname ) {
169 169
 			if ( ! class_exists( $classname ) ) {
170
-				unset( $this->control_types[ $key ] );
170
+				unset( $this->control_types[$key] );
171 171
 			}
172 172
 		}
173 173
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 			foreach ( Kirki::$panels as $panel_args ) {
196 196
 				// Extra checks for nested panels.
197 197
 				if ( isset( $panel_args['panel'] ) ) {
198
-					if ( isset( Kirki::$panels[ $panel_args['panel'] ] ) ) {
198
+					if ( isset( Kirki::$panels[$panel_args['panel']] ) ) {
199 199
 						// Set the type to nested.
200 200
 						$panel_args['type'] = 'kirki-nested';
201 201
 					}
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 			foreach ( Kirki::$sections as $section_args ) {
218 218
 				// Extra checks for nested sections.
219 219
 				if ( isset( $section_args['section'] ) ) {
220
-					if ( isset( Kirki::$sections[ $section_args['section'] ] ) ) {
220
+					if ( isset( Kirki::$sections[$section_args['section']] ) ) {
221 221
 						// Set the type to nested.
222 222
 						$section_args['type'] = 'kirki-nested';
223 223
 						// We need to check if the parent section is nested inside a panel.
224
-						$parent_section = Kirki::$sections[ $section_args['section'] ];
224
+						$parent_section = Kirki::$sections[$section_args['section']];
225 225
 						if ( isset( $parent_section['panel'] ) ) {
226 226
 							$section_args['panel'] = $parent_section['panel'];
227 227
 						}
Please login to merge, or discard this patch.
core/class-kirki-util.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,9 +118,9 @@
 block discarded – undo
118 118
 						// If we have a variable_callback defined then get the value of the option
119 119
 						// and run it through the callback function.
120 120
 						// If no callback is defined (false) then just get the value.
121
-						$variables[ $variable_name ] = Kirki_Values::get_value( $field['settings'] );
121
+						$variables[$variable_name] = Kirki_Values::get_value( $field['settings'] );
122 122
 						if ( $variable_callback ) {
123
-							$variables[ $variable_name ] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) );
123
+							$variables[$variable_name] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) );
124 124
 						}
125 125
 					}
126 126
 				}
Please login to merge, or discard this patch.
core/class-kirki-values.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function typography_field_tweaks( $value, $field_id ) {
42 42
 
43
-		if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['type'] ) ) {
44
-			if ( 'kirki-typography' === Kirki::$fields[ $field_id ]['type'] ) {
43
+		if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['type'] ) ) {
44
+			if ( 'kirki-typography' === Kirki::$fields[$field_id]['type'] ) {
45 45
 
46 46
 				// Sanitize the value.
47 47
 				// This also adds font-weight if it doesn't already exist.
@@ -83,43 +83,43 @@  discard block
 block discarded – undo
83 83
 		$config_id = ( '' === $config_id ) ? 'global' : $config_id;
84 84
 
85 85
 		// Fallback to 'global' if $config_id is not found.
86
-		if ( ! isset( Kirki::$config[ $config_id ] ) ) {
86
+		if ( ! isset( Kirki::$config[$config_id] ) ) {
87 87
 			$config_id = 'global';
88 88
 		}
89 89
 
90
-		if ( 'theme_mod' === Kirki::$config[ $config_id ]['option_type'] ) {
90
+		if ( 'theme_mod' === Kirki::$config[$config_id]['option_type'] ) {
91 91
 
92 92
 			// We're using theme_mods so just get the value using get_theme_mod.
93 93
 			$default_value = null;
94
-			if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) {
95
-				$default_value = Kirki::$fields[ $field_id ]['default'];
94
+			if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) {
95
+				$default_value = Kirki::$fields[$field_id]['default'];
96 96
 			}
97 97
 			$value = get_theme_mod( $field_id, $default_value );
98 98
 			return apply_filters( 'kirki/values/get_value', $value, $field_id );
99 99
 		}
100 100
 
101
-		if ( 'option' === Kirki::$config[ $config_id ]['option_type'] ) {
101
+		if ( 'option' === Kirki::$config[$config_id]['option_type'] ) {
102 102
 
103 103
 			// We're using options.
104
-			if ( '' !== Kirki::$config[ $config_id ]['option_name'] ) {
104
+			if ( '' !== Kirki::$config[$config_id]['option_name'] ) {
105 105
 
106 106
 				// Options are serialized as a single option in the db.
107 107
 				// We'll have to get the option and then get the item from the array.
108
-				$options = get_option( Kirki::$config[ $config_id ]['option_name'] );
108
+				$options = get_option( Kirki::$config[$config_id]['option_name'] );
109 109
 
110
-				if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) {
111
-					$field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']';
110
+				if ( ! isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'] ) ) {
111
+					$field_id = Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']';
112 112
 				}
113
-				$setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) );
113
+				$setting_modified = str_replace( ']', '', str_replace( Kirki::$config[$config_id]['option_name'] . '[', '', $field_id ) );
114 114
 
115
-				$default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) ? Kirki::$fields[ $field_id ]['default'] : '';
116
-				$value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : $default_value;
115
+				$default_value = ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) ? Kirki::$fields[$field_id]['default'] : '';
116
+				$value = ( isset( $options[$setting_modified] ) ) ? $options[$setting_modified] : $default_value;
117 117
 				$value = maybe_unserialize( $value );
118 118
 				return apply_filters( 'kirki/values/get_value', $value, $field_id );
119 119
 			}
120 120
 
121 121
 			// Each option separately saved in the db.
122
-			$value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] );
122
+			$value = get_option( $field_id, Kirki::$fields[$field_id]['default'] );
123 123
 			return apply_filters( 'kirki/values/get_value', $value, $field_id );
124 124
 
125 125
 		} // End if().
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 			if ( isset( $field['option_name'] ) && '' !== $field['option_name'] ) {
145 145
 				$all_values = get_option( $field['option_name'], array() );
146 146
 				$sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] );
147
-				if ( isset( $all_values[ $sub_setting_id ] ) ) {
148
-					$value = $all_values[ $sub_setting_id ];
147
+				if ( isset( $all_values[$sub_setting_id] ) ) {
148
+					$value = $all_values[$sub_setting_id];
149 149
 				}
150 150
 			} else {
151 151
 				$value = get_option( $field['settings'], $field['default'] );
Please login to merge, or discard this patch.
modules/css/field/class-kirki-output-field-image.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,15 +34,15 @@
 block discarded – undo
34 34
 		) );
35 35
 		if ( is_array( $value ) ) {
36 36
 			if ( isset( $output['choice'] ) && $output['choice'] ) {
37
-				$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value[ $output['choice'] ] ) . $output['units'] . $output['suffix'];
37
+				$this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value[$output['choice']] ) . $output['units'] . $output['suffix'];
38 38
 				return;
39 39
 			}
40 40
 			if ( isset( $value['url'] ) ) {
41
-				$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value['url'] ) . $output['units'] . $output['suffix'];
41
+				$this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value['url'] ) . $output['units'] . $output['suffix'];
42 42
 				return;
43 43
 			}
44 44
 			return;
45 45
 		}
46
-		$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix'];
46
+		$this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix'];
47 47
 	}
48 48
 }
Please login to merge, or discard this patch.
modules/css/field/class-kirki-output-field-dimensions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 			if ( false !== strpos( $output['property'], '%%' ) ) {
45 45
 				$property = str_replace( '%%', $key, $output['property'] );
46 46
 			}
47
-			$this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $this->process_property_value( $property, $value[ $key ] ) . $output['suffix'];
47
+			$this->styles[$output['media_query']][$output['element']][$property] = $output['prefix'] . $this->process_property_value( $property, $value[$key] ) . $output['suffix'];
48 48
 		}
49 49
 	}
50 50
 }
Please login to merge, or discard this patch.
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.